@orbit/core
Classes​
Interfaces​
References​
default​
Renames and re-exports Orbit
Type aliases​
Listener​
Ƭ Listener: (...args
: any
[]) => any
Type declaration​
â–¸ (...args
): any
Parameters​
Name | Type |
---|---|
...args | any [] |
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​
Name | Type |
---|---|
Klass | Object |
Klass.prototype | any |
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​
Name | Type |
---|---|
obj | Evented <string > |
eventName | string |
...args | unknown [] |
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​
Name | Type |
---|---|
obj | Evented <string > |
eventName | string |
...args | unknown [] |
Returns​
Promise
<unknown
[]>
Defined in​
packages/@orbit/core/src/evented.ts:156
isEvented​
â–¸ isEvented(obj
): boolean
Has a class been decorated as @evented
?
Parameters​
Name | Type |
---|---|
obj | unknown |
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​
Name | Type |
---|---|
obj | Evented <string > |
eventName | string |
...args | unknown [] |
Returns​
Promise
<unknown
[]>