---
url: https://docs.moqtail.dev/ts/api/client/classes/ObjectOrderer.md
---
# Class: ObjectOrderer

Releases one request's objects in location order, whatever streams or datagrams they
arrived on. An object goes out as soon as its predecessor has; one whose predecessor
is missing waits until the window is exceeded, then everything up to the oldest held
object goes out and the expected locations skipped are reported through `gap`.

Nothing is released yet, so the first object goes out at once only when it starts a
group: a mid-group first object waits for the start of its group, which a fill fetch
stream may still bring.

## Constructors

### Constructor

> **new ObjectOrderer**(`ordering`, `onRelease`, `onGap`): `ObjectOrderer`

#### Parameters

##### ordering

[`ObjectOrdering`](../interfaces/ObjectOrdering.md)

##### onRelease

(`object`) => `void`

##### onGap

(`from`, `to`) => `void`

#### Returns

`ObjectOrderer`

## Methods

### endGroup()

> **endGroup**(`group`, `lastObject`): `void`

A stream carrying the End of Group for `group` ended cleanly with `lastObject`.

#### Parameters

##### group

`bigint`

##### lastObject

`bigint`

#### Returns

`void`

***

### flush()

> **flush**(): `void`

Releases everything held, in order, and stops the timer. Call before closing the stream.

#### Returns

`void`

***

### push()

> **push**(`object`, `previous?`): `void`

Takes an object; `previous` is the object before it on the same fetch stream.

#### Parameters

##### object

[`MoqtObject`](../../model/classes/MoqtObject.md)

##### previous?

[`Location`](../../model/classes/Location.md)

#### Returns

`void`

***

### resumeWindow()

> **resumeWindow**(`reason`): `void`

Resuming the last reason releases at once what waited longer than the window.

#### Parameters

##### reason

[`WindowSuspension`](../type-aliases/WindowSuspension.md)

#### Returns

`void`

***

### suspendWindow()

> **suspendWindow**(`reason`): `void`

While suspended for any reason nothing exceeds the window, so held objects wait for what's missing.

#### Parameters

##### reason

[`WindowSuspension`](../type-aliases/WindowSuspension.md)

#### Returns

`void`
