use()
#
Available since 2.8.0
Adds a plugin to this application.
This method can only be used before the application is started.
use (
plugin: Plugin,
options: {
name?: string,
manifest?: JSONObject,
deprecationWarning?: boolean
} = {}
)
Argument | Type | Description |
---|---|---|
plugin | Plugin | Plugin class extending the Plugin abstract class |
options | object | Additionnal options |
options:
Property | Type | Description |
---|---|---|
name | string | Specify the plugin name instead of using the class name |
manifest | object | Manually add a manifest definition |
deprecationWarning | boolean | If false, does not display deprecation warnings |
Usage #
import { Plugin, PluginContext, JSONObject } from 'kuzzle'
class MailerPlugin extends Plugin {
constructor () { }
async init (config: JSONObject, context: PluginContext) {
this.config = config;
this.context = context;
}
}
app.plugin.use(new MailerPlugin())
Edit this page on Github (opens new window)