Skip to content

Abstract Class: D3PObject<M> ​

Defined in: core/object.ts:25

Base of every emitter: owns a bus reference, a table of per-instance event symbols (always containing destroyed) and a subscription bag released on destroy().

Extended by ​

Type Parameters ​

M ​

M extends object = { }

Constructors ​

Constructor ​

ts
new D3PObject<M>(
   label, 
   eventNames?, 
   bus?
): D3PObject<M>;

Defined in: core/object.ts:35

Parameters ​

label ​

string

eventNames? ​

readonly (keyof M & string)[] = []

bus? ​

D3PBus

Returns ​

D3PObject<M>

Methods ​

destroy() ​

ts
destroy(): void;

Defined in: core/object.ts:51

Detaches the object from all its charts, announces destroyed and releases its subscriptions. The object cannot be used afterwards.

Returns ​

void


fire() ​

ts
protected fire<P>(event, ...args): void;

Defined in: core/object.ts:41

Emits one of its own events on the bus.

Type Parameters ​

P ​

P

Parameters ​

event ​

D3PEvent<P>

args ​

...P extends void ? [] : [payload: P]

Returns ​

void


onDestroy() ​

ts
protected onDestroy(): void;

Defined in: core/object.ts:46

Hook run first on destroy (detach from partners, release DOM...).

Returns ​

void

Properties ​

bus ​

ts
readonly bus: D3PBus;

Defined in: core/object.ts:27

The bus the object uses for its events.


e ​

ts
readonly e: D3PEventTable<M & object>;

Defined in: core/object.ts:29

The events of the object, by name: destroyed for all, and its own (axis.e.scaleChanged).


isDestroying ​

ts
isDestroying: boolean = false;

Defined in: core/object.ts:31

Set when destroy starts: the object is not drawn after that.


subs ​

ts
protected readonly subs: D3PSubscriptions;

Defined in: core/object.ts:33

The subscriptions of the object, released when it is destroyed.