2.8.1 • Published 6 months ago

@xlit/event v2.8.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@xlit/event

Work with events

Installation

npm i @xlit/event

Getting started

import { MemoryEventBus, select } from '@xlit/event';

class Event1 {
  kind = 'Event1';
}

class Event2 {
  kind = 'Event2';
}

const bus = new MemoryEventBus();

bus.addHandler((evt) => {
  // handle all events
});

bus.addHandler(select('Event1', (evt: Event1) => {
  // handle only Event1 events
}));

bus.addHandler(select('Event2', (evt: Event2) => {
  // handle only Event2 events
}));

bus.dispatchEvent(new Event1());
bus.dispatchEvent(new Event2());
2.8.1

6 months ago

2.8.0

6 months ago

2.7.4

7 months ago

2.7.3

7 months ago

2.7.2

7 months ago

2.7.1

7 months ago

2.7.0

7 months ago

2.6.14

7 months ago

2.6.13

7 months ago

2.6.12

7 months ago

2.6.11

8 months ago

2.6.10

8 months ago

2.6.9

8 months ago

2.6.8

8 months ago

2.6.7

8 months ago

2.6.6

8 months ago

2.6.5

8 months ago

2.6.4

9 months ago

2.6.3

9 months ago

2.6.2

9 months ago

2.6.1

9 months ago

2.6.0

9 months ago

2.5.1

10 months ago

2.5.0

10 months ago

2.4.0

10 months ago