PluginManager

client. PluginManager

Component dedicated at registering, instantiating and initializing plugins.

An instance of the PluginManager is automatically created by the soundworks.Client.

Constructor

new PluginManager()

Source:
See:
Example
import soundworks from '@soundworks/core/client';

// create a new `soundworks.Client` instance
const client = new soundworks.Client();
client.pluginManager.register('my-plugin', myPluginFactory, {}, []);

Methods

get(name)

Source:
See:

Returns an instance of a plugin with options to be applied to its constructor. Warning: using this method do not attach any client to the plugin (as does client.AbstractExperience#require, use this method only if you know what you are doing.

Parameters:
Name Type Description
name String

Name of the plugin.

register(name, factory, optionsopt, depsopt)

Source:
See:

Register the client-side part of a plugin into soundworks instance.

Notes:

  • A plugin must always be registered (and required) both client-side and server-side
  • A plugin factory can be used several times with different names to create several instances of the plugin
Example
```js
client.pluginManager.register('user-defined-name', pluginFactory);
```
Parameters:
Name Type Attributes Default Description
name String

Name of the plugin

factory function

Factory function that return the plugin class

options Object <optional>
{}

Options to configure the plugin

deps Array <optional>
[]

List of plugins' names the plugin depends on, aka the plugins that the plugin should wait for being ready before start