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

1.0.0 • Public • Published

Message Emitter

Execute functions estimulated by events.

installation

yarn add message-emitter

usage

import * as Emitter from 'message-emitter';

const whitelistedCompanies = ['012345678910234', '432019876543210'];

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 );

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i message-emitter

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    7.13 kB

    Total Files

    7

    Last publish

    Collaborators

    • lucasliet