{"name":"emitter-listener","version":"1.1.1","description":"(Meta)observability for EventEmitters.","main":"listener.js","directories":{"test":"test"},"scripts":{"test":"tap test/*.tap.js"},"repository":{"type":"git","url":"git+https://github.com/othiym23/emitter-listener.git"},"keywords":["wow","such","introspection","amaze","listener","so","observe"],"author":{"name":"Forrest L Norvell","email":"ogd@aoaioxxysz.net"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/othiym23/emitter-listener/issues"},"homepage":"https://github.com/othiym23/emitter-listener","devDependencies":{"tap":"^10.7.3"},"dependencies":{"shimmer":"^1.2.0"},"gitHead":"04f454bb894d5e1ea795ae22541f8fc6b57fbeb3","_id":"emitter-listener@1.1.1","_shasum":"e8bbbe8244bc8e0d0b4ef71cd14294c7f241c7ec","_from":".","_npmVersion":"2.15.1","_nodeVersion":"0.10.48","_npmUser":{"name":"othiym23","email":"ogd@aoaioxxysz.net"},"dist":{"shasum":"e8bbbe8244bc8e0d0b4ef71cd14294c7f241c7ec","tarball":"http://registry-npm.ywwl.com/emitter-listener/download/emitter-listener-1.1.1.tgz","integrity":"sha512-uEYD66UNJsDJIYgx8lpP7YiexDMvOyRx1Kpl5rHmxXc7402pi91+BUE3oj0qQUsJakHj89CZfjIMC+NMOXtJ/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1VvFmnqiC81W+nnERpeg56yiQiOs6DVqrJB+krt9VpQIga9W1674AN8NQF3uhhp5vW79cw4NRncdMML4QIkmmqAs="}],"size":16920,"noattachment":false,"key":"/emitter-listener/-/emitter-listener-1.1.1.tgz"},"maintainers":[{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/emitter-listener-1.1.1.tgz_1511211578771_0.30010690353810787"},"readme":"## Add dynamic instrumentation to emitters\n\n`shimmer` does a bunch of the work necessary to wrap other methods in\na wrapper you provide:\n\n```javascript\nvar EventEmitter = require('events').EventEmitter;\nvar wrapEmitter = require('emitter-listener');\n\nvar ee = new EventEmitter();\n\nvar id = 0;\n\nwrapEmitter(\n  ee,\n  function mark(listener) {\n    listener.id = id++;\n  },\n  function prepare(listener) {\n    console.log('listener id is %d', listener.id);\n  }\n);\n```\n\n### Mandatory disclaimer\n\nThere are times when it's necessary to monkeypatch default behavior in\nJavaScript and Node. However, changing the behavior of the runtime on the fly\nis rarely a good idea, and you should be using this module because you need to,\nnot because it seems like fun.\n\n#### wrapEmitter(emitter, mark, prepare)\n\nWrap an EventEmitter's event listeners. Each listener will be passed to\n`mark` when it is registered with `.addListener()` or `.on()`, and then\neach listener is passed to `prepare` to be wrapped before it's called\nby the `.emit()` call. `wrapListener` deals with the single listener\nvs array of listeners logic, and also ensures that edge cases like\n`.removeListener()` being called from within an `.emit()` for the same\nevent type is handled properly.\n\nThe wrapped EE can be restored to its pristine state by using\nemitter.__unwrap(), but this should only be used if you *really* know\nwhat you're doing.\n","publish_time":1511211578838,"_cnpm_publish_time":1511211578838,"dist-tags":{"latest":"1.1.2"}}