Plugins

UaSDK. Plugins

Plugins loader

Constructor

new Plugins()

Loads and provides access to plugins in the SDK.

Example
// You will access this through the sdk
UA.then(function(sdk) { sdk.plugins })

Methods

(async) get(name) → {Promise.<unknown>}

Get a plugin by its name. Plugin should be loaded first using plugins.load(...) using the same name.

Parameters:
Name Type Description
name "html-prompt" | "registration-page"

Plugin name

Returns:
Type:
Promise.<unknown>

Resolves to the plugin instance. On error, the promise will be rejected with the associated error.

Example
UA.then(function(sdk) {
 sdk.plugins.get('my_plugin')
   .then(plugin => {
     // use the plugin instance
   })
})

load(name, url, opts) → {Promise.<unknown>}

Load a plugin

Parameters:
Name Type Description
name "html-prompt" | "subscription-form"

Plugin name

url string

Plugin URL

opts unknown

Plugin options to be passed to the plugin

Returns:
Type:
Promise.<unknown>

Resolves to the plugin instance

Example
UA.then(function(sdk) {
   sdk.plugins.load('my_plugin')
     .then(plugin => plugin.myMethod())
})