Skip to main content

Class: Assets

Assets API is a part of the Player SDK used for fetching assets and theme. Use global enplug.assets object to access these methods.

Example usage of the Assets API
const asset = await enplug.assets.getNext();

Useful commands:

Methods#

getNext#

getNext<T>(): Promise<T>

Fetches the asset that is to be displayed by the app.

When it is time to present certain asset of your app, the Player will instantiate a new iframe with a new instance of your app. Then, the app can fetch the value of the asset, so it has access to all the settings and customizations made on the Dashboard part of the app.

Fetching the asset's value
const assetValue = await enplug.assets.getNext();

Type parameters#

NameDescription
TModel of asset's value

Returns#

Promise<T>

Returns a Promise that resolves to the single asset value. This is what was saved as 'asset.Value' on the Dashboard part of the app.


getTheme#

getTheme<T>(): Promise<T>

Type parameters#

Name
T

Returns#

Promise<T>