message-emitter
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Message Emitter

Execute functions estimulated by events.

installation

yarn add message-emitter

usage

import * as Emitter from 'message-emitter';

Emitter.publish('test', 1, 2, 3 ,4 ); // pulish to topic 'test' the args 1, 2, 3, 4 

Emitter.subscribe('test', args => console.log(args)); // if the topic was published execute callback function to given arguments

Emitter.deleteTopic('test'); // remove topic

Emitter.hasTopic('test'); // returns true if topic exists, otherwise false

ℹ for JavaScript <= es5 use require

var Emitter = require('message-emitter');
Emitter.publish('test', 1, 2, 3 ,4 );

/message-emitter/

    Package Sidebar

    Install

    npm i message-emitter

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    7.07 kB

    Total Files

    7

    Last publish

    Collaborators

    • lucasliet