Utils
In this example, we will show you how to use the CreativeEditor SDK's CreativeEngine to forcibly pre-load all resources contained in a scene.
Setup#
This example uses the headless CreativeEngine. See the Setup article for a detailed guide.
To get started right away, you can also access the block
API within a running CE.SDK instance via cesdk.engine.block
.
Check out the APIs Overview to see that illustrated in more detail.
Working with resources#
By default, a scene's resources are loaded on-demand.
You can manually trigger the loading of all resources in a scene of for specific blocks by calling forceLoadResources
.
Any set of blocks can be passed as argument and whatever resources these blocks require will be loaded.
forceLoadResources(ids: DesignBlockId[]): Promise<void>
Begins loading the resources of the given blocks and their children. If the resource had been loaded earlier and resulted in an error, it will be reloaded. This function is useful for preloading resources before they are needed. Warning: For elements with a source set, all elements in the source set will be loaded.
ids
: The blocks whose resources should be loaded. The given blocks don't require to have resources and can have children blocks (e.g. a scene block or a page block).- Returns A Promise that resolves once the resources have finished loading.