JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23
  • Score
    100M100P100Q53756F
  • License MIT

Javascript Events

Package Exports

  • capillaries

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 (capillaries) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Capillaries Build Status

Javascript Events

Getting Started

Installation

Installation can be done via package managers such as npm or yarn

% npm install capillaries

# or

% yarn add capillaries

or use cdn

Minified:

//cdn.jsdelivr.net/npm/capillaries@latest/capillaries.umd.min.js

Pretty Printed:

//cdn.jsdelivr.net/npm/capillaries@latest/capillaries.umd.js

Usage

import Capillaries from 'capillaries';

const event = new Capillaries();

const listener = function(payload) {
  console.log('Event Received:', payload);
};

const anotherListener = function(payload) {
  console.log('Event Received:', payload);
};

// create a event listeners
event.on('connecting', listener);
event.on('connected', listener);
event.on('connecting', anotherListener);
event.on('connected', anotherListener, this); // optionally bind context to the listener when invoked

// dispatch events
event.emit('connected', 'paylod');

// remvoe a particular event listener
event.off('connected', listener);

// remove all listeners for an event
event.off('connected');

// unbind all event listeners
event.unbindAll();

API

import Capillaries from 'capillaries';

const event = new Capillaries();
  • event.on
  • event.off
  • event.emit
  • event.unbindAll