sugo-module-base
Base module for SUGOS
Table of Contents
Requirements
Installation
$ npm install sugo-module-base --save
Usage
Register a module to actor.
#!/usr/bin/env node /** * Example usage of the caller */'use strict' const Module = const sugoActor = const co =
Then, call the module from a remote caller.
#!/usr/bin/env node /** * Example control from a remote caller * @see https://github.com/realglobe-Inc/sugo-caller */'use strict' const co = const assert = const sugoCaller =
Advanced Usage
$spec
Description with You can describe a module with $spec
property.
The spec object must conform to module_spec.json, a JSON-Schema.
#!/usr/bin/env node /** * Example usage of the caller */'use strict' const Module = const sugoActor = const co =
Define Custom Class
You can define you own class by extending Module
class
/** * @MyCustomClass */'use strict' const Module = { superconfig } { /* ... */ } get return /* ... */ moduleexports = MyCustomClass
Use Mixins
Sometimes you need to share functions between classes.
Javascript Class Mix-In would do this.
/** * Example to use mixin */'use strict' const Module = const HiPeople = { console } const YoPeople = { console } { const s = this s s } moduleexports = MyPerson
Modularize Existing Class
Want to use an existing class? You can use modularize()
method to define a new module class from existing class.
Since SUGO-Actor not supports callback base function, you may need some hack.
/** * Example to modularize an existing class */'use strict' const modularize = const sugoActor = const co =
License
This software is released under the Apache-2.0 License.