Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 1.36 KB

5.api.md

File metadata and controls

61 lines (41 loc) · 1.36 KB

API usage

Call function

The function signature is:

call({args = [], handler, hooks = [], name})

Execute a hander function and its associated hooks. The first argument is an object with the properties:

  • args (any) Argument pass to the handler function as well as all hook handlers
  • handler (function)
    Function to decorate, receive the value assocaited with the args property.
  • name (string)
    Name of the hook to execute.
  • hooks ([hook])
    List of completary hooks from the end user.

Get function

The function signature is:

get({name, hooks, sort})

The get function return hooks. It expects a property option which is a literal object with the properties:

  • name (string)
    Name of the hook to retrieve.
  • hooks ([hook]) List of completary hooks from the end user.
  • sort (boolean)
    Sort the hooks relatively to each other using the after and before properties.

Register function

The function signature is:

register(plugin)

Plugin can be provided when instantiating Plug-And-Play by passing the plugins property or they can be provided later on by calling the register function. The function only accept one argument, the plugin property:

  • plugin (plugin)
    Plugin object.

Registed function

The function signature is:

registered(name)

Check if a plugin is registered.