Intro
Installable via npm install --save @chakrajs/framework, it can also be used directly in the browser.
Download
The source is available for download from GitHub. Alternatively, you can install using npm:
$ npm install --save @chakrajs/framework
You can then require() @chakrajs/framework as normal:
const chakrajsFramework = require('@chakrajs/framework')
In the Browser
@chakrajs/framework should work in any ES2015 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of @chakrajs/framework, including index.js and index.min.js, are included in the /dist folder. @chakrajs/framework can also be found on unkpkg.com under
Chakra
Chakra main class
Parameters
config: Object (={}):Configuration of the Chakra instance
EventBus
Publish-subscribe event-bus
instance
EventBus.prototype.register
register(entity: String, action: String, schema: Object): undefinedRegister a new topic with the event bus
Parameters
Returns
EventBus.prototype.subscribe
subscribe(entity: String, action: String, publishHandler: function): stringSubscribe to a new topic
Parameters
Returns
string Subscription key for the subscription
Throws
any Will throw if the topic is not found.
TopicRegistry
Schema registry for the topics
instance
TopicRegistry.prototype.register
register(topic: Topic, schema: Object): undefinedAdd new topic to the registry
Returns
Throws
Error Will throw if topic is already registered
TopicRegistry.prototype.isRegistered
isRegistered(topic: Topic): booleanCheck if a given topic is registered with the registry.
Parameters
topic: Topic:Topic to verify registration
Returns
boolean Whether the topic is already registered