dolphin-core-modules
v0.1.6
Published
Modules for dolphin
Downloads
3
Readme
Main core module to build any modules
Installation
npm install dolphin-core-modules --save
How to create new Module
var Module = require('dolphin-core-modules').Module;
//the first parameter is name of module, unique for all modules
//the second is current path
var test = new Module('Test', __dirname);
You can create factories via two ways:
- Folder
- API
- Folder
root_of_package
factories
You must return object with two keys:
name
entity
Example
module.exports = {
name: 'Config',
entity: {
}
};
- API
test.addFactory('Any_name', function () {
return {
some keys or methods
};
});
After initialization your factory will get name TestConfigFactory
Configuration other factories
test.configureFactories(function (/*Name_OF_Factory*/, /*Name_OF_Factory*/...) {
//here you can change any settings of factories
});
Run main logic
test.run(function (/*Name_OF_Factory*/, /*Name_OF_Factory*/...) {
//here you will get last versions of factories
});