Skip to main content
Version: 0.17

@orbit/core

Classes​

Interfaces​

References​

default​

Renames and re-exports Orbit

Type aliases​

Listener​

Ƭ Listener: (...args: any[]) => any

Type declaration​

â–¸ (...args): any

Parameters​
NameType
...argsany[]
Returns​

any

Defined in​

packages/@orbit/core/src/notifier.ts:1

Variables​

Orbit​

• Orbit: OrbitGlobal

Defined in​

packages/@orbit/core/src/main.ts:35

Functions​

evented​

â–¸ evented(Klass): void

Marks a class as evented.

An evented class should also implement the Evented interface.

import { evented, Evented } from '@orbit/core';

@evented
class Source implements Evented {
...
}

Listeners can then register themselves for particular events with on:

let source = new Source();

function listener1(message: string) {
console.log('listener1 heard ' + message);
};
function listener2(message: string) {
console.log('listener2 heard ' + message);
};

source.on('greeting', listener1);
source.on('greeting', listener2);

evented.emit('greeting', 'hello'); // logs "listener1 heard hello" and
// "listener2 heard hello"

Listeners can be unregistered from events at any time with off:

source.off('greeting', listener2);

Parameters​

NameType
KlassObject
Klass.prototypeany

Returns​

void

Defined in​

packages/@orbit/core/src/evented.ts:72


fulfillAll​

â–¸ fulfillAll(obj, eventName, ...args): Promise<unknown[]>

Fulfills any promises returned by event listeners in parallel, using Promise.all.

Returns an array of results (or undefined) returned by listeners.

On error, processing will stop and the returned promise will be rejected with the error that was encountered.

Parameters​

NameType
objEvented<string>
eventNamestring
...argsunknown[]

Returns​

Promise<unknown[]>

Defined in​

packages/@orbit/core/src/evented.ts:180


fulfillInSeries​

â–¸ fulfillInSeries(obj, eventName, ...args): Promise<unknown[]>

Fulfills any promises returned by event listeners in series.

Returns an array of results (or undefined) returned by listeners.

On error, processing will stop and the returned promise will be rejected with the error that was encountered.

Parameters​

NameType
objEvented<string>
eventNamestring
...argsunknown[]

Returns​

Promise<unknown[]>

Defined in​

packages/@orbit/core/src/evented.ts:156


isEvented​

â–¸ isEvented(obj): boolean

Has a class been decorated as @evented?

Parameters​

NameType
objunknown

Returns​

boolean

Defined in​

packages/@orbit/core/src/evented.ts:8


settleInSeries​

â–¸ settleInSeries(obj, eventName, ...args): Promise<unknown[]>

Settle any promises returned by event listeners in series.

Returns an array of results (or undefined) returned by listeners.

If any errors are encountered during processing, they will be caught and returned with other results. Errors will not interrupt further processing.

Parameters​

NameType
objEvented<string>
eventNamestring
...argsunknown[]

Returns​

Promise<unknown[]>

Defined in​

packages/@orbit/core/src/evented.ts:130