emity

Event System Lib

Usage no npm install needed!

<script type="module">
  import emity from 'https://cdn.skypack.dev/emity';
</script>

README

Build Status

Emity

A simple event system library. Supports Browser or Node environments.

Installation

npm install emity
bower install emity

Usage

var Emity = require('emity'); // For node

var emity   = new Emity();
var context = {};

## On
emity.on('something', function () {
  // do something
}, context);


## Emit
emity.emit('something'); // performs do something

emity.off('something');

emity.emit('something'); // nothing happens

## Off
emity.off('*'); // remove all events
emity.off(); // remove all events

## Once
emity.once('happens_once', function () {
  // do something
});

emity.emit('happens_once'); // will perform something
emity.emit('happens_once'); // nothing happens

Contribution & Setup

  • git clone git@github.com:djalmaaraujo/emity.git
  • npm install
  • Run the tests: npm test
  • Watch for file changes: npm run watch

License

MIT License © Djalma Araújo


cc company - Code Consultants and Open Source Coding