Eventary is a little library that helps you to implement powerful event systems, middleware oriented codes and pluggable/extensible modules.
This module works by
hooking into events and
dispatching new events to be
hooked by someone else, here a litte demonstration
var Eventary = ;var events = ;// We will listen for 'uppercase' eventsevents;// Now let's emit some eventsevents;
But wait, there is more, we can have async hooks too!
// With a second argument we tell Eventary// that this magic is asyncevents;// Now let's emit some eventsevents;
"My EventEmitter can do this too." you would say, so here is an example
http.Server with middlewares and highly pluggable events.
var Eventary = ;var events = ;var http = ;// We will listen the main pageevents;// Listen to '/user/whatever'events;// Listen to '/error'events;// Listen for EVERY routeevents;// Start the serverhttp;
Testing is easy, you need to have
grunt-cli installed globally, clone this
npm install inside the folder and run
- Add comments inline inside the code.
- Add browser support.
- Write down the API.
- Write moar fancy stuff.
- Benchmarks, everyone loves benchmarks!
Copyright (c) 2014, Alan Hoffmeister email@example.com
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.