---
url: https://cri-middleware.github.io/SSPlayerForReactNative/api/functions/loadResource.md
---
# Function: loadResource()

> **loadResource**(`source`): `Promise`<[`LoadedResource`](../interfaces/LoadedResource.md)>

Defined in: [packages/react-native-spritestudio/src/player/source.ts:80](https://github.com/cri-middleware/SSPlayerForReactNative/blob/ddb0878ad347fd4a411e4e2eb0829a948cb07ff8/packages/react-native-spritestudio/src/player/source.ts#L80)

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`](../type-aliases/SsSource.md)

## Returns

`Promise`<[`LoadedResource`](../interfaces/LoadedResource.md)>
