All Projects → scottcorgan → Tiny Emitter

scottcorgan / Tiny Emitter

Licence: mit
A tiny (less than 1k) event emitter library

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Tiny Emitter

xtra
🎭 A tiny actor framework
Stars: ✭ 111 (-80.66%)
Mutual labels:  tiny
Gretchen
Making fetch happen in TypeScript.
Stars: ✭ 301 (-47.56%)
Mutual labels:  tiny
Split
Unopinionated utilities for resizeable split views
Stars: ✭ 5,176 (+801.74%)
Mutual labels:  tiny
Zzfx
A Tiny Sound FX System / Zuper Zmall Zound Zynth
Stars: ✭ 279 (-51.39%)
Mutual labels:  tiny
Zzfxm
A super small music generator for use in size-limited JavaScript productions
Stars: ✭ 294 (-48.78%)
Mutual labels:  tiny
Lucia
🙋‍♀️ 3kb library for tiny web apps
Stars: ✭ 439 (-23.52%)
Mutual labels:  tiny
Microdot
The Microdot Project guides you to create a fully functional but compact Linux system from scratch
Stars: ✭ 41 (-92.86%)
Mutual labels:  tiny
Cash
An absurdly small jQuery alternative for modern browsers.
Stars: ✭ 5,714 (+895.47%)
Mutual labels:  tiny
Redom
Tiny (2 KB) turboboosted JavaScript library for creating user interfaces.
Stars: ✭ 3,123 (+444.08%)
Mutual labels:  tiny
Apkgolf
The smallest Android APK in the world
Stars: ✭ 528 (-8.01%)
Mutual labels:  tiny
Polychrome
🎨 Easy color manipulation in ~2kb (gzipped)
Stars: ✭ 286 (-50.17%)
Mutual labels:  tiny
Eo Locale
🌏Internationalize js apps 👔Elegant lightweight library based on Internationalization API
Stars: ✭ 290 (-49.48%)
Mutual labels:  tiny
Wsify
Just a tiny, simple and real-time self-hosted pub/sub messaging service
Stars: ✭ 452 (-21.25%)
Mutual labels:  tiny
Topbar
Tiny & beautiful site-wide progress indicator
Stars: ✭ 262 (-54.36%)
Mutual labels:  tiny
Fflate
High performance (de)compression in an 8kB package
Stars: ✭ 547 (-4.7%)
Mutual labels:  tiny
tinysyslog
A tiny and simple syslog server with log rotation in Go. Works with Docker and Kubernetes.
Stars: ✭ 26 (-95.47%)
Mutual labels:  tiny
Favicon.js
A tiny (817 bytes) library for changing the favicon
Stars: ✭ 351 (-38.85%)
Mutual labels:  tiny
Unfetch
🐕 Bare minimum 500b fetch polyfill.
Stars: ✭ 5,239 (+812.72%)
Mutual labels:  tiny
Minimal
A Delightfully Diminutive Lisp. Implemented in < 1 KB of JavaScript with JSON source, macros, tail-calls, JS interop, error-handling, and more.
Stars: ✭ 560 (-2.44%)
Mutual labels:  tiny
Timeago.js
🕗 ⌛ timeago.js is a tiny(2.0 kb) library used to format date with `*** time ago` statement.
Stars: ✭ 4,670 (+713.59%)
Mutual labels:  tiny

tiny-emitter

A tiny (less than 1k) event emitter library.

Install

npm

npm install tiny-emitter --save

Usage

var Emitter = require('tiny-emitter');
var emitter = new Emitter();

emitter.on('some-event', function (arg1, arg2, arg3) {
 //
});

emitter.emit('some-event', 'arg1 value', 'arg2 value', 'arg3 value');

Alternatively, you can skip the initialization step by requiring tiny-emitter/instance instead. This pulls in an already initialized emitter.

var emitter = require('tiny-emitter/instance');

emitter.on('some-event', function (arg1, arg2, arg3) {
 //
});

emitter.emit('some-event', 'arg1 value', 'arg2 value', 'arg3 value');

Instance Methods

on(event, callback[, context])

Subscribe to an event

  • event - the name of the event to subscribe to
  • callback - the function to call when event is emitted
  • context - (OPTIONAL) - the context to bind the event callback to

once(event, callback[, context])

Subscribe to an event only once

  • event - the name of the event to subscribe to
  • callback - the function to call when event is emitted
  • context - (OPTIONAL) - the context to bind the event callback to

off(event[, callback])

Unsubscribe from an event or all events. If no callback is provided, it unsubscribes you from all events.

  • event - the name of the event to unsubscribe from
  • callback - the function used when binding to the event

emit(event[, arguments...])

Trigger a named event

  • event - the event name to emit
  • arguments... - any number of arguments to pass to the event subscribers

Test and Build

Build (Tests, Browserifies, and minifies)

npm install
npm run build

Test

npm install
npm test

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].