# Scheduler

class in `3d-tiles-renderer/core`

```js
import { Scheduler } from '3d-tiles-renderer/core';
```

Class used within TilesRenderer for scheduling requestAnimationFrame events and
toggling between XRSession rAF and window rAF toggles.

## Methods

### setXRSession

```js
setXRSession( session: XRSession )
```

Sets the active "XRSession" value to use to scheduling rAF callbacks.

- `session`, `XRSession`

### requestAnimationFrame

```js
requestAnimationFrame( cb: function ): number
```

Request animation frame (defer to XR session if set)

- `cb`, `function`

### cancelAnimationFrame

```js
cancelAnimationFrame( handle: number )
```

Cancel animation frame via handle (defer to XR session if set)

- `handle`, `number`

### flushPending

```js
flushPending(  )
```

Flush and complete pending AFs (defer to XR session if set)
