# RealtimeAsset

Class · extends `Events` · category: Internal

Source: https://github.com/playcanvas/editor-api/blob/4303c34bcee9a418297350899ad3a3f555526ec4/src/realtime/asset.ts#L11

Represents an asset in sharedb

## Constructors

### constructor

```ts
new RealtimeAsset(uniqueId: number, realtime: Realtime, connection: RealtimeConnection)
```

Constructor

**Parameters**

- `uniqueId` (`number`): The unique asset id
- `realtime` ([`Realtime`](https://api.playcanvas.com/editor/classes/Realtime.md)): The realtime API
- `connection` ([`RealtimeConnection`](https://api.playcanvas.com/editor/classes/RealtimeConnection.md)): The realtime connection

## Accessors

### data

```ts
get data(): any
```

The asset data

### id

```ts
get id(): number
```

The asset id - used in combination with branch id

### loaded

```ts
get loaded(): boolean
```

Whether the asset is loaded

### uniqueId

```ts
get uniqueId(): number
```

The asset's unique id

## Methods

### load

```ts
load(): void
```

Loads asset from sharedb and subscribes to changes.

### submitOp

```ts
submitOp(op: object, callback?: Function): void
```

Submits sharedb operation

**Parameters**

- `op` (`object`): The operation
- `callback` (`Function`, optional): The callback

### unload

```ts
unload(): void
```

Unloads asset from sharedb and unsubscribes from changes.

### whenNothingPending

```ts
whenNothingPending(callback: Function): void
```

Calls the callback when there are no changes pending to be
sent to the server

**Parameters**

- `callback` (`Function`): The callback
