LucidJS: a lightweight, dependency-free event emitter library
robertwhurst.github.com
LucidJS: a lightweight, dependency-free event emitter library
1–7 of 7 posts
Re: LucidJS: a lightweight, dependency-free event emitter library
#2If you are using jQuery and just need a simple generic event emitter, you may not need this library.
var emitter = jQuery({});
emitter.on('ready', function() { alert("Ready!"); });
emitter.trigger('ready');
...or if you're on Node, Node.js already has API for events: var EventEmitter = require('events').EventEmitter;
var emitter = new EventEmitter();
emitter.on('ready', function() { alert("Ready!"); });
emitter.trigger('ready');
The reason you'd use LucidJS is for its other features that these solutions don't have, like `.set()` and `.pipe()`.Re: LucidJS: a lightweight, dependency-free event emitter library
#3For those looking for more event libraries, try Stapes.js. As a bonus you'll also get class creation and MVC-like get/set with change events:
http://hay.github.com/stapes/#m-mixinEvents
Full disclosure: i'm the author :)
Re: LucidJS: a lightweight, dependency-free event emitter library
#4If you are using jQuery and just need a simple generic event emitter, you may not need this library. var emitter = jQuery({}); emitter.on('ready', function() { alert("Ready!"); }); emitter.trigger('ready'); ...or if you're on Node, Node.js already has API for events: var EventEmitter = require('events').EventEmitter; var emitter = new EventEmitter(); emitter.on('ready', function() { alert("Ready!"); }); emitter.trigg…
The author did a talk at VanJS today, and he compared LucidJS with other events library[1]. From what I got out of it, besides the nice features it offers (set/pipe/etc), this is probably most useful for people who would like to release a library/JS API without depending on one of the "heavier" frameworks - for example, libraries like History.js would be able to use LucidJS as the events library instead of coupling with something like jQuery or rolling their own.
Re: LucidJS: a lightweight, dependency-free event emitter library
#5It might be nice to register on component(1) registry.
https://github.com/component/component/wiki/Components
Re: LucidJS: a lightweight, dependency-free event emitter library
#6Can someone give me a basic explanation/examples of the use cases of event emitters?
Re: LucidJS: a lightweight, dependency-free event emitter library
#7Since its not stated anywhere that I could see, and I wanted to see its 'lightweightness'...minified it is 8.9k and gzipped it is 2.3k