# TextureAtlasHandler

Class · extends [`ResourceHandler`](https://api.playcanvas.com/engine/classes/ResourceHandler.md) · category: Asset

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/framework/handlers/texture-atlas.js#L41

Resource handler for the `textureatlas` asset type. Loads a texture and its frame definitions
into a [TextureAtlas](https://api.playcanvas.com/engine/classes/TextureAtlas.md). The frames come from the asset data, or from a JSON file with a
texture of the same name beside it.

## Methods

### load

```ts
load(url: any, callback: any): void
```

Load a resource from a remote URL. When parsers are registered, the matching parser's `load` is
used; otherwise the base implementation does nothing (subclasses may override).

**Parameters**

- `url` (`any`): Either the URL of the resource to
  load or a structure containing the load URL (used for loading the resource) and the original
  URL (used for identifying the resource format; necessary when loading, for example, from
  a blob URL).
- `callback` (`any`): The callback used when the resource is loaded or
  an error occurs.

### open

```ts
open(url: any, data: any, asset: any): TextureAtlas | null
```

The open function is passed the raw resource data. The handler can then process the data
into a format that can be used at runtime. When parsers are registered, the matching parser's
`open` is used (if it implements one); otherwise the base implementation simply returns the data.

**Parameters**

- `url` (`any`): The URL of the resource to open.
- `data` (`any`): The raw resource data passed by callback from [load](https://api.playcanvas.com/engine/classes/ResourceHandler.md#load).
- `asset` (`any`): Optional asset that is passed by ResourceLoader.

**Returns** [`TextureAtlas`](https://api.playcanvas.com/engine/classes/TextureAtlas.md) `| null`: The parsed resource data.

### patch

```ts
patch(asset: any, assets: any): void
```

The patch function performs any operations on a resource that requires a dependency on its
asset data or any other asset data. The base implementation does nothing.

**Parameters**

- `asset` (`any`): The asset to patch.
- `assets` (`any`): The asset registry.

## Inherited from [ResourceHandler](https://api.playcanvas.com/engine/classes/ResourceHandler.md)

- `protected _app: AppBase`
- `handlerType: string = ''`
- `get app(): AppBase`
- `get maxRetries(): number` · `set maxRetries(value: number)`
- `get parsers(): ResourceParser[]`
- `addParser(parser: ResourceParser, decider?: any): void`
- `fetch(url: string | { load: string; original: string }, responseType: string, callback: ResourceHandlerCallback, asset?: Asset<string>): void`
- `removeParser(parser: ResourceParser): void`
