Skip to content

Function: loadResource() ​

loadResource(source): Promise<LoadedResource>

Defined in: packages/react-native-spritestudio/src/player/source.ts:80

Loads a .ssab into a Layer 1 resource, taking a cache lease on it.

Two of the three routes keep the bytes out of the JS heap entirely: C++ opens the file or the APK entry. Only a remote URL has to be fetched, and only a dev server or a CDN is one.

The lease is the caller's to give back with releaseResource(uri): a second player of the same pack shares this resource, so disposing it directly would pull the .ssab out from under a player that is still drawing.

Parameters ​

source ​

SsSource

Returns ​

Promise<LoadedResource>