JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 36
  • Score
    100M100P100Q52405F
  • License ISC

Asynchronous version of EventEmitter, secured by promises

Package Exports

  • asynchronous-eventemitter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (asynchronous-eventemitter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

asynchronous-eventemitter

Asynchronous version of EventEmitter, secured by promises

Build Status Coverage Status Dependency Status

Installation

$ npm install asynchronous-eventemitter

Doc

  • see node events documentation
  • fire "error" event if an error has thrown in an event listener
  • fire "looperror" event if an error has thrown in an "error" event listener
  • you can now chain "emit" events, the method return the class' pointer

Examples

Typescript

import Events = require("asynchronous-eventemitter");

new Events().on("error", (err: Error) => {
  console.log(err);
}).on("test", (arg1: string, arg2: string, arg3: string) => {
  console.log(arg1, arg2, arg3);
}).emit("test", "arg1", "arg2", "arg3").emit("test2");

Native

const Events = require("asynchronous-eventemitter");

new Events().on("error", function(err) {
  console.log(err);
}).on("test", function(arg1, arg2, arg3) {
  console.log(arg1, arg2, arg3);
}).emit("test", "arg1", "arg2", "arg3").emit("test2");

Tests

$ gulp

License

ISC