{"id":14156624,"url":"https://github.com/baileyherbert/events","last_synced_at":"2026-01-23T13:59:58.887Z","repository":{"id":66348455,"uuid":"428532063","full_name":"baileyherbert/events","owner":"baileyherbert","description":"A strongly typed event emitter for Node.js and browsers.","archived":false,"fork":false,"pushed_at":"2024-01-20T15:36:35.000Z","size":106,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-13T02:21:03.570Z","etag":null,"topics":["eventemitter","events","typed","typescript"],"latest_commit_sha":null,"homepage":"https://npmjs.com/@baileyherbert/events","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baileyherbert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-16T05:44:21.000Z","updated_at":"2024-07-11T00:11:01.000Z","dependencies_parsed_at":"2024-07-12T01:43:18.971Z","dependency_job_id":"49286eac-5586-40d4-8dec-ebd057053a2a","html_url":"https://github.com/baileyherbert/events","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"6dc4da1ea01fe32dd113af6fa4bff6e91575304f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/baileyherbert/events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baileyherbert%2Fevents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baileyherbert%2Fevents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baileyherbert%2Fevents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baileyherbert%2Fevents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baileyherbert","download_url":"https://codeload.github.com/baileyherbert/events/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baileyherbert%2Fevents/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28693434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["eventemitter","events","typed","typescript"],"created_at":"2024-08-17T08:07:25.368Z","updated_at":"2026-01-23T13:59:58.861Z","avatar_url":"https://github.com/baileyherbert.png","language":"TypeScript","funding_links":[],"categories":["typescript"],"sub_categories":[],"readme":"# Events\n\nThis is an alternative event emitter that works on all platforms. It allows you to specify the event types, and keeps\nthe `emit` method protected.\n\n```\nnpm install @baileyherbert/events\n```\n\n## Example\n\nExtend the `EventEmitter` class and provide an enumeration of tuples for `\u003cT\u003e`:\n\n```ts\nimport { EventEmitter } from '@baileyherbert/events';\n\nexport class Chat extends EventEmitter\u003cEvents\u003e {\n\tprotected _onUserConnected(user: User) {\n\t\tthis.emit('connected', user.username);\n\t}\n}\n\ntype Events = {\n\t/**\n\t * These JSDoc comments will show up in intellisense too!\n\t */\n\tchat: [username: string, message: string];\n\tconnected: [username: string];\n\tdisconnected: [username: string];\n};\n```\n\nThen you can listen to those events like usual, but with autocompleted event names and typed arguments. 👍\n\n```ts\nconst chat = new Chat();\n\nchat.on('connected', username =\u003e {});\nchat.on('disconnected', username =\u003e {});\nchat.on('chat', (username, message) =\u003e {});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaileyherbert%2Fevents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaileyherbert%2Fevents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaileyherbert%2Fevents/lists"}