2.0.0 • Published 4 years ago

tukio v2.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Tukio

Tukio is a minimal Pub-Sub implementation using class based events.

Why

Most of the javascript Pub-Sub implementations use string based events, which makes it impossible for static type analysers like Typescript to infer the shape of an event inside an event handler. Tukio resolves this by using class based events.

Installation:

npm install tukio --save

Usage:

import EventBus from 'tukio';

const eventBus = new EventBus();

class TodoNameUpdated {
    name: string;
    constructor(name: string) {
        this.name = name;
    }
}

eventBus.subscribe(TodoNameUpdated, (event) => {
    // Typescript can infer that event has a property name
    console.log(event.name);
});

eventBus.publish(new TodoNameUpdated('new name'));
2.0.0-1

4 years ago

2.0.0

4 years ago

2.0.0-0

4 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago