{"name":"emitter-listener","version":"1.1.2","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":"7586fba839cf87774d5df224ce479c3b7e2b9964","_id":"emitter-listener@1.1.2","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"othiym23","email":"ogd@aoaioxxysz.net"},"dist":{"integrity":"sha512-Bt1sBAGFHY9DKY+4/2cV6izcKJUf5T7/gkdmkxzX/qv9CcGH8xSwVRW5mtX03SWJtRTWSOpzCuWN9rBFYZepZQ==","shasum":"56b140e8f6992375b3d7cb2cab1cc7432d9632e8","tarball":"http://registry-npm.ywwl.com/emitter-listener/download/emitter-listener-1.1.2.tgz","fileCount":5,"unpackedSize":12727,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbuSE0CRA9TVsSAnZWagAAg5sP/1gDSEnMsGqjnnFxP+bA\nn1A6Kjp5d124xIUpC7ZFmw178K/BXyWeMBftoA9ivju7se3YWPj8tmKXx+Ls\nUiAA+ISRcYUzd4svPHIuOqAau1kNzoDECU5Dy5MvMLw7wi0RpU2JEDA0B6aP\ntTD2u/nqOXZjS36NpSQUY9u3Ft+l+Qiwr4EfnrQbZswuzNK4wk3ga7IKvQu9\nrebEyqEyegv0/mLEYTxwe379vJit5fZEihdG/m5I2V8ECKiuJrVr+/+yTeM1\nCjQlZ6xzX3BEx16n0Dw3Al3bTQAmpsiNc/cC345Dmc7WPpjdbBW5UrUV+IQr\nMz+EC5dJj2JR8CSU08N6IKMDsE6ZtFgxysBlN5eIts/fhjKLoSYjHlxAPoDK\n+J/O8Hq7RDBf2iMSVbD84l8x1VSMwy0RslqhZJfMoiYP0A4XkkHNntr2ovlr\nTDk2DWmQNJbJXwb9U1taC4AT9bks67pssWWn77WWfD6xTR8jjYoSf0BjKJjJ\n2z/r1i0hru3trZBGeq6NUtsZfljh5ikPr3O/9eJNb06LD+c0EL9cFnYQwgtC\nnbr9BrvljrBei2LBx6N+d0DHSlhophgJIRRKIqRHwa2U6DRHNjvSgj0uBMX0\ngr+mYaw01+hSRK8skfI49mWsNahxUlMYZ5XoSQdg8dHjbDWOPQyrCPU3qcQQ\n6EqT\r\n=n/Ti\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFUcIR3Qa7H8XcV7K7KMFv+EyqD6jGG8FLewHDSw0WHaAiEA8lvPoJbW74Qy8JnWOwkdoxXZlofcyYNq+Kj9k6VD+Lw="}],"size":3975,"noattachment":false,"key":"/emitter-listener/-/emitter-listener-1.1.2.tgz"},"maintainers":[{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/emitter-listener_1.1.2_1538859315239_0.10846004964367006"},"_hasShrinkwrap":false,"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":1538859315390,"_cnpm_publish_time":1538859315390,"dist-tags":{"latest":"1.1.2"}}