Constructor
new PluginApi()
Defines a base plugin API for all plugins' which need to expose an API.
- Source:
Example
// Implement a PluginApi : "MyPluginApi"
// for a plugin named "my-plugin"
var util = require('util');
var openVeoApi = require('@openveo/api');
function MyPluginApi() {
MyPluginApi.super_.call(this);
}
util.inherits(MyPluginApi, openVeoApi.plugin.PluginApi);
// Associate the API to the plugin when creating it
function MyPlugin() {
MyPlugin.super_.call(this);
// Exposes MyPlugin's APIs
this.api = new MyPluginApi();
}
util.inherits(MyPlugin, openVeoApi.plugin.Plugin);
Members
(readonly) actions :Object
The list of registered actions.
Property names are the action names and values are functions.
Type:
- Object
- Source:
Methods
executeHook(hook, data, callback)
Executes all actions registered for a hook.
All actions are executed in the registration order.
Parameters:
Name | Type | Description |
---|---|---|
hook |
String | The hook associated to actions |
data |
* | The data to transmit to the actions |
callback |
callback | The function to call when it's done |
- Source:
getHooks() → {Object}
Gets available hooks of the plugin.
This should be overrided by plugins.
- Source:
Returns:
The list of hooks
- Type
- Object
registerAction(hook, action)
Registers an action to be executed when a hook occurs.
Parameters:
Name | Type | Description |
---|---|---|
hook |
String | The hook to register action on |
action |
function | The function to execute when hook is executed |
- Source:
unregisterAction(hook, action)
Unregisters an action registered on a hook.
Parameters:
Name | Type | Description |
---|---|---|
hook |
String | The hook to unregister action from |
action |
function | The function action |
- Source: