TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

LucidJS: a lightweight, dependency-free event emitter library

13 pointsby godfreykfcover 12 years ago

5 comments

huskyrover 12 years ago
For 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:<p><a href="http://hay.github.com/stapes/#m-mixinEvents" rel="nofollow">http://hay.github.com/stapes/#m-mixinEvents</a><p>Full disclosure: i'm the author :)
rstacruzover 12 years ago
If you are using jQuery and just need a simple generic event emitter, you may not need this library.<p><pre><code> var emitter = jQuery({}); emitter.on('ready', function() { alert("Ready!"); }); emitter.trigger('ready'); </code></pre> ...or if you're on Node, Node.js already has API for events:<p><pre><code> var EventEmitter = require('events').EventEmitter; var emitter = new EventEmitter(); emitter.on('ready', function() { alert("Ready!"); }); emitter.trigger('ready'); </code></pre> The reason you'd use LucidJS is for its other features that these solutions don't have, like `.set()` and `.pipe()`.
评论 #5212204 未加载
smagchover 12 years ago
It might be nice to register on component(1) registry. <a href="https://github.com/component/component/wiki/Components" rel="nofollow">https://github.com/component/component/wiki/Components</a>
binarymaxover 12 years ago
Since 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
borplkover 12 years ago
Can someone give me a basic explanation/examples of the use cases of event emitters?