Eventify

event-emitter.Eventify

Class for adding event handling capability

class SomeClass extends Eventify<{ start: (node: Node) => boolean; }> {
  constructor() {
    super();
    setTimeout(() => {
      if (this.emit('start', document.body)) {
        console.log('yes');
      };
    }, 100);
  }
}

const sm = new SomeClass();
sm.on('start', (node) => {
  console.log(node);
  return true;
})

Type parameters

Name Type
MAP extends Object
EVENT extends keyof MAP = keyof MAP

Hierarchy

Implements

constructor

new Eventify<MAP, EVENT>(): Eventify<MAP, EVENT>

Type parameters

Name Type
MAP extends Object
EVENT extends string | number | symbol = keyof MAP

Returns

Eventify<MAP, EVENT>

on

on(name, func): this

Parameters

Name Type
name EVENT
func MAP[EVENT]

Returns

this

Defined in

src/core/event-emitter/eventify.ts#42


off

off(name, func): this

Parameters

Name Type
name keyof MAP
func MAP[EVENT]

Returns

this

Defined in

src/core/event-emitter/eventify.ts#52


destruct

destruct(): void

Returns

void

Implementation of

IDestructible.destruct

Defined in

jodit/src/core/event-emitter/eventify.ts:60