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.

Show HN: MicroEvent.js - js micro event emitter in less than 20lines

60 pointsby jerome_etienneabout 14 years ago

6 comments

amadeusabout 14 years ago
I really like the code, I think it's very well written!<p>A couple small suggestions and thoughts:<p>Add a couple lines so that all methods return this; to allow for chaining, especially helpful when using it as a mixin.<p>Rename bind/unbind method names since they have completely different meanings/uses in ES5:<p><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind" rel="nofollow">https://developer.mozilla.org/en/JavaScript/Reference/Global...</a><p>P.S. If you're down with those changes I'll gladly fork, update and send a pull req, although not sure what you'd want to rename the api too.
评论 #2360440 未加载
aw3c2about 14 years ago
Wouldn't tiny code like this better included in the HTML itself? A fraction of a packet size versus a HTTP request.
评论 #2360282 未加载
评论 #2360328 未加载
yatsykabout 14 years ago
Backbone by documentcloud could be the other option to consider because 4k of gzipped code is not so big also.
评论 #2359975 未加载
maxogdenabout 14 years ago
Reminds me of <a href="https://github.com/jivesoftware/jiverscripts" rel="nofollow">https://github.com/jivesoftware/jiverscripts</a>. Check out the conc.observable component
peregrineabout 14 years ago
To be honest I was surprised you couldn't bind, trigger, or unbind on a function this way already. I guess I never came across a specific need for it.
oscilloscopeabout 14 years ago
Dmitry's got something similar, Eve: <a href="http://dmitry.baranovskiy.com/eve/" rel="nofollow">http://dmitry.baranovskiy.com/eve/</a>