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:
enplug.assets.getNext()
- fetch the value of the asset that is to be displayedenplug.assets.getTheme()
- get the theme
#
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 parametersName | Description |
---|---|
T | Model of asset's value |
#
ReturnsPromise
<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 parametersName |
---|
T |
#
ReturnsPromise
<T
>