0.7.1 • Published 9 months ago

@nbottarini/eventbus v0.7.1

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

npm License: MIT CI Status

EventBus

Simple and lightweight EventBus javascript implementation

Installation

Npm:

$ npm install --save @nbottarini/eventbus

Yarn:

$ yarn add @nbottarini/eventbus

Usage

class Producer {
    constructor(private eventBus: EventBus) {}

    async doSomething() {
        await eventBus.post(new SampleEvent())
    }
}

class Consumer {
    constructor(private eventBus: EventBus) {
        this.eventBus.subscribe(this, SampleEvent, this.onSampleEvent)        
    }

    onSampleEvent(event: SampleEvent) {
        // Do Something
    }
}

class SampleEvent extends EventInterface {
}
0.7.1

9 months ago

0.7.0

9 months ago

0.6.2

11 months ago

0.6.1

11 months ago

0.6.0

11 months ago