minsky-plugin-manager v1.0.0
Plugin Manager
A manager that can be added to classes internally in order to have a plugin structure.
This manager should run inside a class providing a way to support a plugin-like structure. Even though it is still unfinished, it is already somewhat incorporated inside some classes.
Class type: Manager
Dependencies
- Core 1.0.0
Getting started
Inits in a static way. Provided class definition gets the right injections every time it is constructed.
// Add to the bottom of the class
let plugins = new PluginManager({
Target: [Class],
});
Constructor Parameters
Target
Type: Class
Default: none
The target class definition it will manage.
plugins
Type: Array
Default: []
Array of plugins it will automatically define when it is constructed.
Interface
Options
Target
Type: Class
Default: none
The target class definition it will manage.
plugins
Type: Array
Default: []
Array of plugins it will automatically define when it is constructed.
Properties
Target
Type: Class
Default: none
The target class definition it will manage.
plugins
Type: Array
Default: []
Array of plugins it will automatically define when it is constructed.
Methods
define
Parameters: plugins:Array
Return: undefined
Registers a plugin so it can be added to every instance that is managed by the manager.
get
Parameters: pluginsId:Number
Return: Plugin Object
Returns the requested plugin if found.
setOption
Parameters: pluginsId:Number, options:Object
Return: Plugin Object
Sets the given options by merging the given options object with the one of the given plugin.
run
Parameters: method:String, args:Object, scope:Function/Object
Return: Undefined
Runs a specific method of the class it manages with given args. Scope can be altered with the third parameter.
logPlugins
Parameters: none
Return: undefined
Logs a list of registered plugins => usefull for development
destroy
Parameters: none
Return: undefined
Destroys the plugin manager.
To Do
- Finish the class
- Fix scope inconsistencies.
- Provide plugin base class instead of using object literal as plugin definition. * Provide plugin with setOption method for quickly deep mergin of object settings
4 years ago