seneca-basic

1.0.0 • Public • Published

Seneca

A Seneca.js utility plugin

seneca-basic

npm version Dependency Status Build Status Coveralls Gitter chat

This plugin is included with the main seneca module and provides a small set of basic utility action patterns.

If you're using this module, and need help, you can:

seneca-basic's source can be read in an annotated fashion by,

  • running npm run annotate
  • viewing online

The annotated source can be found locally at ./doc/seneca-basic.html.

Seneca compatibility

Supports Seneca versions 1.x - 3.x

Install

This plugin module is included in the main Seneca module.

npm install seneca

Explicit install

To explicitly install separately,

npm install seneca-basic

And in your code:

var seneca = require('seneca')({
  default_plugins: {
    'basic': false
  }
})
 
seneca.use(require('seneca-basic'))

Action Patterns

role:basic, note:true, cmd:set

Set a note value. Notes are a simple internal per-process communication mechanism for plugins to exchange data. In particular, plugins can set keyed values before the plugin that uses the data reads it. See seneca-admin for an example.

Parameters

  • key: string; key name
  • value: key value

Response:

  • None.

role:basic, note:true, cmd:get

Get a note value.

Parameters

  • key: string; key name

Response:

  • value: key value, if defined

role:basic, note:true, cmd:push

Push a note value onto a list. The namespace for lists is separate from the namespace for single values. The list is created if it does not exist.

Parameters

  • key: string; key name
  • value: value to append to list.

Response:

  • None.

role:basic, note:true, cmd:list

Get the full list of values for the key, in pushed order.

Parameters

  • key: string; key name

Response:

  • Array of values.

role:basic, note:true, cmd:pop

Get the last value of a list, and remove it from the list.

Parameters

  • key: string; key name

Response:

  • value: key value, if list was non-empty

Releases

  • 0.3.0: 2015-06-15: Normalized note patterns. Prep for Seneca 0.6.2.

Contributing

The Senecajs org encourage open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.

Test

To run tests, simply use npm:

npm run test

License

Copyright (c) 2014 - 2016, Richard Rodger and other contributors. Licensed under MIT.

Package Sidebar

Install

npm i seneca-basic

Weekly Downloads

528

Version

1.0.0

License

MIT

Unpacked Size

14.8 kB

Total Files

9

Last publish

Collaborators

  • mihaidma
  • rjrodger
  • wyatt