Skip to main content
zerotal

Documentation


Documentation / @zerotal/broadcasting / PendingBroadcast

Class: PendingBroadcast

Defined in: broadcasting/src/PendingBroadcast.ts:9

A deferred broadcast returned by broadcast(event). It is thenable and sends automatically on the next microtask (or immediately when awaited), so .toOthers() can configure it first.

Implements

  • PromiseLike<void>

Constructors

Constructor

new PendingBroadcast(event): PendingBroadcast

Defined in: broadcasting/src/PendingBroadcast.ts:13

Parameters

event

BroadcastEvent

Returns

PendingBroadcast

Methods

toOthers()

toOthers(): this

Defined in: broadcasting/src/PendingBroadcast.ts:19

Exclude the connection that originated the triggering request (its X-Socket-ID), so the user who just made an optimistic update doesn't receive a duplicate.

Returns

this


send()

send(): void

Defined in: broadcasting/src/PendingBroadcast.ts:25

Send now (idempotent). Called automatically on microtask / await.

Returns

void


then()

then<TResult1, TResult2>(onfulfilled?, onrejected?): PromiseLike<TResult1 | TResult2>

Defined in: broadcasting/src/PendingBroadcast.ts:32

Attaches callbacks for the resolution and/or rejection of the Promise.

Type Parameters

TResult1

TResult1 = void

TResult2

TResult2 = never

Parameters

onfulfilled?

((value) => TResult1 | PromiseLike<TResult1>) | null

The callback to execute when the Promise is resolved.

onrejected?

((reason) => TResult2 | PromiseLike<TResult2>) | null

The callback to execute when the Promise is rejected.

Returns

PromiseLike<TResult1 | TResult2>

A Promise for the completion of which ever callback is executed.

Implementation of

PromiseLike.then