{"id":14978140,"url":"https://github.com/socketio/emitter","last_synced_at":"2025-10-02T13:31:08.406Z","repository":{"id":57161284,"uuid":"413288494","full_name":"socketio/emitter","owner":"socketio","description":"Event emitter component","archived":false,"fork":true,"pushed_at":"2024-04-26T05:32:32.000Z","size":72,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-19T22:17:58.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"sindresorhus/component-emitter","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/socketio.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-04T05:41:44.000Z","updated_at":"2024-05-24T21:10:37.000Z","dependencies_parsed_at":"2023-01-22T01:49:52.246Z","dependency_job_id":null,"html_url":"https://github.com/socketio/emitter","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketio%2Femitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketio%2Femitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketio%2Femitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketio%2Femitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socketio","download_url":"https://codeload.github.com/socketio/emitter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219862635,"owners_count":16553913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:56:55.737Z","updated_at":"2025-10-02T13:31:03.124Z","avatar_url":"https://github.com/socketio.png","language":"JavaScript","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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketio%2Femitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketio%2Femitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketio%2Femitter/lists"}