Skip to content

Class: D3PServiceRegistry ​

Defined in: core/services.ts:31

The services of a chart, by key: one object for each key (the axes, the renderers, the interaction area, the probe), that can be provided, read and watched.

Constructors ​

Constructor ​

ts
new D3PServiceRegistry(bus, label): D3PServiceRegistry;

Defined in: core/services.ts:36

Parameters ​

bus ​

D3PBus

label ​

string

Returns ​

D3PServiceRegistry

Methods ​

get() ​

ts
get<T>(key): T | undefined;

Defined in: core/services.ts:59

The service of that key, or undefined.

Type Parameters ​

T ​

T

Parameters ​

key ​

D3PServiceKey<T>

Returns ​

T | undefined


provide() ​

ts
provide<T>(key, service): void;

Defined in: core/services.ts:44

Registers a service. The watchers of the key are told, later.

Type Parameters ​

T ​

T

Parameters ​

key ​

D3PServiceKey<T>

service ​

T

Returns ​

void


remove() ​

ts
remove<T>(key, service?): void;

Defined in: core/services.ts:51

Remove a service; when service is given it only applies if it is the registered one.

Type Parameters ​

T ​

T

Parameters ​

key ​

D3PServiceKey<T>

service? ​

T

Returns ​

void


require() ​

ts
require<T>(key): T;

Defined in: core/services.ts:64

The service of that key. Throws an error if there is none.

Type Parameters ​

T ​

T

Parameters ​

key ​

D3PServiceKey<T>

Returns ​

T


watch() ​

ts
watch<T>(key, cb): D3PUnsubscribe;

Defined in: core/services.ts:74

Call cb with the current service now (if any) and on every later change. The callback is idempotent-safe: it is never called twice in a row with the same value.

Type Parameters ​

T ​

T

Parameters ​

key ​

D3PServiceKey<T>

cb ​

(service) => void

Returns ​

D3PUnsubscribe

Properties ​

changed ​

ts
readonly changed: D3PEvent<D3PServiceChange>;

Defined in: core/services.ts:34

Announced (asynchronously) each time a service appears, changes or disappears.