{"name":"microee","description":"A tiny EventEmitter-like client and server side library","version":"0.0.2","author":{"name":"Mikito Takada","email":"mixu@mixu.net","url":"http://mixu.net/"},"keywords":["event","events","eventemitter","emitter"],"repository":{"type":"git","url":"git://github.com/mixu/microee"},"main":"index.js","scripts":{"test":"./node_modules/.bin/mocha --ui exports --reporter spec --bail ./test/microee.test.js"},"devDependencies":{"mocha":"*"},"_id":"microee@0.0.2","dist":{"shasum":"72e80d477075e5e799470f5defea96d1dd121587","tarball":"http://registry-npm.ywwl.com/microee/download/microee-0.0.2.tgz","integrity":"sha512-YtNUgIojy1brPWluzA/lE+vf21Tf4qgfs9vqbgY0tFZTsLqKkc+P/UHjf1UrLjB0RSqmPbNm3dihC/HvkqZnTg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHjQy/qL9asX0nn3/gcfmSW3Q7LKNm9isQZtX0+VkKNdAiBdHltSY7OWqEIT6teybKUwaCnTJ3S4xgf0dGnxZoXMcQ=="}],"size":1933,"noattachment":false,"key":"/microee/-/microee-0.0.2.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"directories":{},"readme":"# microEE\n\nA client and server side library for routing events.\n\n[![Build Status](https://secure.travis-ci.org/mixu/microee.png?branch=master)](https://travis-ci.org/mixu/microee)\n\nI was disgusted by the size of [MiniEE](https://github.com/mixu/miniee) (122 sloc, 4.4kb), so I decided a rewrite was in order.\n\nMicroEE is a more satisfying (~50 sloc, ~1200 characters), and passes the same tests as MiniEE (excluding the RegExp support, but including many real-world tests, such as removing a once() callback, and checking for the correct order of once callback removal).\n\n# Installing:\n\n    npm install microee\n\n# In-browser version\n\nUse the version in `./dist/`. It exports a single global, `microee`.\n\nTo run the in-browser tests, open `./test/index.html` in the browser after cloning this repo and doing npm install (to get Mocha).\n\n# Usage example: `microee.mixin`\n\n    var MicroEE = require('microee');\n    function MyClass() {\n      // ...\n    }\n    MicroEE.mixin(MyClass);\n    MyClass.prototype.foo = function() {\n      // ...\n    };\n\n    var obj = new MyClass();\n    // set string callback\n    obj.on('event', function(arg1, arg2) { console.log(arg1, arg2); });\n    obj.emit('event', 'aaa', 'bbb'); // trigger callback\n\n# API\n\nThe API is based on [Node's EventEmitter](http://nodejs.org/api/events.html).\n\nThere are two additional niceties: `emitter.when(event, listener)` and `.mixin()`.\n\nSupport for `emitter.listeners(event)` was added in `v0.0.6`.\n\n## emitter.on(event, listener)\n\nAdds a listener to the end of the listeners array for the specified event.\n\n```\nserver.on('connection', function (stream) {\n  console.log('someone connected!');\n});\n```\n\nReturns emitter, so calls can be chained.\n\n## emitter.once(event, listener)\n\nAdds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.\n\nReturns emitter, so calls can be chained.\n\n## emitter.when(event, listener)\n\nAddition to the regular API. If `listener` returns true, the listener is removed. Useful for waiting for a particular set of parameters on a recurring event e.g. in tests.\n\nReturns emitter, so calls can be chained.\n\n## microee.mixin(object)\n\nAddition to the regular API. Extends `object.prototype` with all the microee methods, allowing other classes to act like event emitters.\n\n## emitter.emit(event, [arg1], [arg2], [...])\n\nExecute all listeners on `event`, with the supplied arguments.\n\nReturns emitter, so calls can be chained.\n\n## emitter.removeListener(event, listener)\n\nRemove a listener from the listener array for the specified event.\n\n## emitter.removeAllListeners([event])\n\nRemoves all listeners, or those of the specified event.\n\n## emitter.listeners(event)\n\nReturns an array of listeners for the specified event.\n","publish_time":1349474665299,"_cnpm_publish_time":1349474665299,"dist-tags":{"latest":"0.0.6"}}