Collar class
Collar class provides the several top level static functions
Get the collar instance directly
const collar = require('collar.js');
Collar.ns(namespace, meta)
Create a new namespace with name and metadata. Namespace is used to create node, and group node. Each node must belong to only one namespace. You need to create a namespace first to create nodes.
For the operators defined in namespace, see SYNC/ASYNC OPERATORS from the left side bar
Arguments
Arguement | Type | Description |
---|---|---|
namespace | string | the namespace name |
meta | map | the meta data |
Return
Type | Description |
---|---|
Namespace | the namespace |
create a namespace
const collar = require('collar.js');
const ns = collar.ns('com.collartechs.demo', {
author: 'Bo HOU',
module: 'test.namespace'
});
// now you can use ns to build your app / data flow
Collar.use(addon)
Use an addon to extend collar. Addon could add additional operators on both collar and namespace object. See Addon section
Note: you need to use addons at the very beginning of your application
Arguments
Arguement | Type | Description |
---|---|---|
addon | Addon | the addon object |
Return
Type | Description |
---|---|
Collar | the extended collar object |
create a namespace
const collar = require('collar.js');
const DevToolAddon = require('collar.js-dev-client');
collar.use(new DevToolAddon());