{"name":"@socket.io/component-emitter","description":"Event emitter","version":"3.1.2","license":"MIT","devDependencies":{"mocha":"*","should":"*"},"component":{"scripts":{"emitter/index.js":"index.js"}},"main":"./lib/cjs/index.js","module":"./lib/esm/index.js","types":"./lib/cjs/index.d.ts","repository":{"type":"git","url":"git+https://github.com/socketio/emitter.git"},"scripts":{"test":"make test"},"gitHead":"8a2ece1f367dd9898791ee663940386147d2d688","bugs":{"url":"https://github.com/socketio/emitter/issues"},"homepage":"https://github.com/socketio/emitter#readme","_id":"@socket.io/component-emitter@3.1.2","_nodeVersion":"20.3.0","_npmVersion":"9.6.7","dist":{"integrity":"sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==","shasum":"821f8442f4175d8f0467b9daf26e3a18e2d02af2","tarball":"http://registry-npm.ywwl.com/@socket.io/component-emitter/download/@socket.io/component-emitter-3.1.2.tgz","fileCount":9,"unpackedSize":21216,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCHrt9fDcdYJGUAfsx6RYwOPj5/RM0GCi13+3LxZniKSAIgZhoQ+kXyUxfPcZu7hXddxVjRm42NzFr1oH8gDmbWbhU="}],"size":4079,"noattachment":false,"key":"/@socket.io/component-emitter/-/@socket.io/component-emitter-3.1.2.tgz"},"_npmUser":{"name":"darrachequesne","email":"damien.arrachequesne@gmail.com"},"directories":{},"maintainers":[{"name":"darrachequesne","email":"damien.arrachequesne@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/component-emitter_3.1.2_1714109537485_0.9594432039475118"},"_hasShrinkwrap":false,"readme":"# `@socket.io/component-emitter`\n\n  Event emitter component.\n\nThis project is a fork of the [`component-emitter`](https://github.com/sindresorhus/component-emitter) project, with [Socket.IO](https://socket.io/)-specific TypeScript typings.\n\n## Installation\n\n```\n$ npm i @socket.io/component-emitter\n```\n\n## API\n\n### Emitter(obj)\n\n  The `Emitter` may also be used as a mixin. For example\n  a \"plain\" object may become an emitter, or you may\n  extend an existing prototype.\n\n  As an `Emitter` instance:\n\n```js\nimport { Emitter } from '@socket.io/component-emitter';\n\nvar emitter = new Emitter;\nemitter.emit('something');\n```\n\n  As a mixin:\n\n```js\nimport { Emitter } from '@socket.io/component-emitter';\n\nvar user = { name: 'tobi' };\nEmitter(user);\n\nuser.emit('im a user');\n```\n\n  As a prototype mixin:\n\n```js\nimport { Emitter } from '@socket.io/component-emitter';\n\nEmitter(User.prototype);\n```\n\n### Emitter#on(event, fn)\n\n  Register an `event` handler `fn`.\n\n### Emitter#once(event, fn)\n\n  Register a single-shot `event` handler `fn`,\n  removed immediately after it is invoked the\n  first time.\n\n### Emitter#off(event, fn)\n\n  * Pass `event` and `fn` to remove a listener.\n  * Pass `event` to remove all listeners on that event.\n  * Pass nothing to remove all listeners on all events.\n\n### Emitter#emit(event, ...)\n\n  Emit an `event` with variable option args.\n\n### Emitter#listeners(event)\n\n  Return an array of callbacks, or an empty array.\n\n### Emitter#hasListeners(event)\n\n  Check if this emitter has `event` handlers.\n\n## License\n\nMIT\n","publish_time":1714109537630,"_cnpm_publish_time":1714109537630,"dist-tags":{"latest":"3.1.2"}}