{"id":15809217,"url":"https://github.com/dimkl/events","last_synced_at":"2025-09-08T00:11:22.484Z","repository":{"id":81737451,"uuid":"602984934","full_name":"dimkl/events","owner":"dimkl","description":"Register events using decorators on service methods","archived":false,"fork":false,"pushed_at":"2025-03-26T22:27:04.000Z","size":392,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-07T01:27:07.520Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dimkl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2023-02-17T11:20:53.000Z","updated_at":"2025-03-26T22:27:08.000Z","dependencies_parsed_at":"2023-12-06T22:28:07.007Z","dependency_job_id":"57541854-1675-4538-8861-32d860b3e4e5","html_url":"https://github.com/dimkl/events","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"b4048e8bb7681f3b717cc7defc5e419f0f4ff367"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/dimkl/events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fevents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fevents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fevents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fevents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimkl","download_url":"https://codeload.github.com/dimkl/events/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fevents/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274113348,"owners_count":25224389,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-05T03:20:33.810Z","updated_at":"2025-09-08T00:11:22.470Z","avatar_url":"https://github.com/dimkl.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Events\n\n`@dimkl/events` is a **dependency-free** JS library for listening \u0026 dispatching events on class methods.\n\n## Installation\n\nUse the package manager [npm](https://nodejs.org/en/download/) to install `@dimkl/events`\n\n```bash\nnpm install @dimkl/events\n```\n\n## Requirements \u0026 limitations\n\n- node \u003e= 16\n- typescript decorators support enabled in tsconfig using `\"experimentalDecorators\": true`\n\n## Usage\n\nExamples can be found in `examples/` folder:\n\n- [Minimal example](./examples/minimal.ts)\n- [Implcit event attachment example](./examples/impplicit-event-attach.ts)\n- [Isolated event bus example](./examples/isolated-event-bus.ts)\n- [Minimal implicit event attachment (with options) example](./examples/event-options.ts)\n\n### Use examples\n\nExecute `npm run setup:examples`\n\n## Testing\n\n[![codecov](https://codecov.io/gh/dimkl/events/branch/main/graph/badge.svg?token=VHYWTFBNHB)](https://codecov.io/gh/dimkl/events)\n\n### Run tests\n\n```\nnpm test\n```\n\n## Support\n\nFor feature request or issues contact me via [email](mailto:dimitris.klouvas@gmail.com) or open an issue in repo\n\n## Publish\n\n```\nnpm version {patch|minor|major}\nnpm publish\n```\n\n## Injecting events types\n\nThe injected event types will be used with `@on` decorator methods and they should be\ndefined using interface merging strategy. Example:\n```typescript\ndeclare global {\n  interface {{eventName}}Event extends IEvent {\n    type: \"{{eventName}}\"\n    data?: {{any_data_type}}\n  }\n\n  interface Events {\n    \"{{eventName}}\": {{eventName}}Event\n  }\n}\n```\n\nYou can also check the `ErrorEvent` definition in codebase.\n\n## Roadmap\n\n- [x] Add tests \u0026 code coverage\n- [x] Add .github/{ISSUE|PULL_REQUEST}\n- [ ] Changelog \u0026 Github Releases\n- [x] Isomorphic support\n- [x] Code coverage shield\n- [ ] Features\n    - [x] @on/dispatch on functions -- not possible\n    - [x] @on/dispatch on class\n    - [x] @on/dispatch for static \u0026 instance methods\n    - [ ] remove event(s) on eventBus\n    - [x] inject events and event types\n- [ ] Github action to publish (if test pass \u0026 coverage not affected)\n    - [ ] on chore -\u003e patch\n    - [ ] on fix -\u003e patch\n    - [ ] on feat -\u003e minor\n    - [ ] on fix|feat with (BREAKING CHANGE) -\u003e major\n- [x] Support react-native (EventTarget is not supported)\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first\nto discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n\n[ISC](https://choosealicense.com/licenses/isc/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimkl%2Fevents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimkl%2Fevents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimkl%2Fevents/lists"}