{"_id":"emitter-only","_rev":"229759","name":"emitter-only","description":"Extend event emitters to allow registering listeners only once.","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"}],"time":{"modified":"2021-06-03T15:45:13.000Z","created":"2015-09-23T20:43:54.567Z","0.1.0":"2015-09-23T20:43:54.567Z"},"users":{},"author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/emitter-only.git"},"versions":{"0.1.0":{"name":"emitter-only","description":"Extend event emitters to allow registering listeners only once.","version":"0.1.0","homepage":"https://github.com/doowb/emitter-only","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/emitter-only.git"},"bugs":{"url":"https://github.com/doowb/emitter-only/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"component-emitter":"^1.2.0","mocha":"*","should":"^7.1.0"},"dependencies":{"define-property":"^0.2.5"},"verb":{"related":{"list":["component-emitter"]}},"gitHead":"66b87897f74e44beae956a2aa0d0350f57ae2e89","_id":"emitter-only@0.1.0","_shasum":"8d128f43eb6a85af690f29ec256755b3bed69076","_from":".","_npmVersion":"2.13.3","_nodeVersion":"0.12.0","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"8d128f43eb6a85af690f29ec256755b3bed69076","size":2265,"noattachment":false,"key":"/emitter-only/-/emitter-only-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/emitter-only/download/emitter-only-0.1.0.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"}],"directories":{},"publish_time":1443041034567,"_cnpm_publish_time":1443041034567,"_hasShrinkwrap":false}},"readme":"# emitter-only [![NPM version](https://badge.fury.io/js/emitter-only.svg)](http://badge.fury.io/js/emitter-only)  [![Build Status](https://travis-ci.org/doowb/emitter-only.svg)](https://travis-ci.org/doowb/emitter-only)\n\n> Extend event emitters to allow registering listeners only once.\n\nInstall with [npm](https://www.npmjs.com/)\n\n```sh\n$ npm i emitter-only --save\n```\n\n## Usage\n\n```js\nvar only = require('emitter-only');\n```\n\n## API\n\n### [only](index.js#L39)\n\nOnly register an event listener one time for the given `name/event` combo.\n\n**Params**\n\n* `name` **{String}**: Name to specify this is a unique listener.\n* `event` **{String}**: Event name to pass to the emitter `on` method.\n* `fn` **{Function}**: Event listener function to pass to the emitter `on` method.\n* `returns` **{Object}**: Return `this` for chaining.\n\n**Example**\n\n```js\nEmitter.prototype.only = function () {\n  return only.apply(this, arguments);\n};\n\nvar emitter = new Emitter();\nemitter.only('one-time', 'foo', function (msg) {\n  console.log('foo 1', msg);\n});\n\nemitter.only('one-time', 'foo', function (msg) {\n  console.log('foo 2', msg);\n});\n\nemitter.emit('foo', 'bar');\n//=> 'foo bar'\n```\n\n## Related projects\n\n[component-emitter](https://www.npmjs.com/package/component-emitter): Event emitter | [homepage](https://github.com/component/emitter)\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm i -d && npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/doowb/emitter-only/issues/new).\n\n## Author\n\n**Brian Woodward**\n\n+ [github/doowb](https://github.com/doowb)\n+ [twitter/doowb](http://twitter.com/doowb)\n\n## License\n\nCopyright © 2015 Brian Woodward\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 23, 2015._","_attachments":{},"homepage":"https://github.com/doowb/emitter-only","bugs":{"url":"https://github.com/doowb/emitter-only/issues"},"license":"MIT"}