Skip to main content

API Documentation for microplugin

MicroPlugin

MicroPlugin

Kind: global class

new MicroPlugin(items, items)

Keep code modularized & extensible. MicroPlugin is a lightweight drop-in plugin architecture for your JavaScript library. Plugins can declare dependencies to other plugins and can be initialized with options (in a variety of formats).

ParamType
itemsarray | object
itemsobject

MicroPlugin.Interface.plugins

Kind: static property of MicroPlugin

MicroPlugin.Interface#initializePlugins(plugins)

Initializes the listed plugins (with options). Acceptable formats:

  • List (without options): - ['a', 'b', 'c']
  • List (with options): - [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
  • Hash (with options): - {'a': { ... }, 'b': { ... }, 'c': { ... }}

Kind: static method of MicroPlugin

ParamType
pluginsmixed

MicroPlugin.Interface#loadPlugin(name)

Loads a plugin.

Kind: static method of MicroPlugin

ParamTypeDescription
namestringThe name of the plugin to load.

MicroPlugin.Interface#require(name)

Initializes a plugin.

Kind: static method of MicroPlugin

ParamType
namestring

MicroPlugin.Interface.define(name, fn)

Registers a plugin.

Kind: static method of MicroPlugin

ParamType
namestring
fnfunction