Hacker News new | ask | show | jobs
by rstacruz 4867 days ago
If 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()`.
1 comments

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.

[1]: http://lucidjs.harp.io/#slide-30