1.1.2 • Published 3 years ago

@protagonists/emitter v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

About

A simple event handler package

NEW   Now works with @protagonists/coerce version 1.1.2!


Table of content

The content below may not correspond to the object structure of the objects


How to use?

Description

This package is used to listen and emit events to react to asynchronous events in a cleaner way

Import

Terminal

npm install @protagonists/emitter

Node.js

const Emitter = require("@protagonists/emitter");

Example

Code:

// Imports
const Emitter = require("@protagonists/emitter");
// Create Emitter instance
const myEmitter = new Emitter();

// Create one time event listener
myEmitter.once("ready", () => {
  console.log("Ready event was sent!");
});

// Emit event
myEmitter.emit("ready");

Output:

Ready event was sent!

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago