When this module is loaded in the b9 constructor, it auto-loads plugin modules
from dependencies
in the main package.json
.
-
pattern
{RegExp}
/b9-/
Package naming pattern which should be auto-loaded. -
package
{String}
"./package.json"
Path to thepackage.json
from which to install plugins fromdependencies
.
Install a new plugin module on the b9
instance.
module
{String|Function}
A module name or path or the module itself.
A plugin module must export a function. Installing the plugin module means
invoking it with the b9
instance. Any configurable options will be assigned an
underscore prefix. The default values of any options should be handled inside
the plugin module. Plugins should be named according to the naming pattern.
// a sample plugin module
module.exports = function( b9 ){
// default value for option "foo"
if ( b9._foo == null ){
b9._foo = 123;
}
// set a public method
b9.doFoo = function(){
return b9._foo;
};
};