{"id":15497516,"url":"https://github.com/bcomnes/node-event-handler","last_synced_at":"2026-06-17T21:02:07.582Z","repository":{"id":65460556,"uuid":"158490103","full_name":"bcomnes/node-event-handler","owner":"bcomnes","description":"A generic Node.js style event handler as a class property","archived":false,"fork":false,"pushed_at":"2018-11-21T05:13:57.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T04:35:57.073Z","etag":null,"topics":["eventlistener"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/bcomnes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":"2018-11-21T04:20:20.000Z","updated_at":"2018-11-21T05:13:53.000Z","dependencies_parsed_at":"2023-01-24T14:45:22.573Z","dependency_job_id":null,"html_url":"https://github.com/bcomnes/node-event-handler","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bcomnes/node-event-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fnode-event-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fnode-event-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fnode-event-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fnode-event-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcomnes","download_url":"https://codeload.github.com/bcomnes/node-event-handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fnode-event-handler/sbom","scorecard":{"id":228741,"data":{"date":"2025-08-11","repo":{"name":"github.com/bcomnes/node-event-handler","commit":"285ef8d93a39d58689520b6e83211055e22455a4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T04:23:35.983Z","repository_id":65460556,"created_at":"2025-08-17T04:23:35.983Z","updated_at":"2025-08-17T04:23:35.983Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34465322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"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":["eventlistener"],"created_at":"2024-10-02T08:39:12.172Z","updated_at":"2026-06-17T21:02:07.542Z","avatar_url":"https://github.com/bcomnes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-event-handler\n[![npm version][npmimg]][npm] [![build status][travisimg]][travis] [![coverage][coverallsimg]][coveralls]\n[![downloads][downloadsimg]][downloads] [![js-standard-style][standardimg]][standard]\n\nA generic Node.js style event handler.\n\n## Installation\n```console\n$ npm install node-event-handler\n```\n\n## Usage\n\n```js\nconst NodeEventHandler = require('node-event-handler')\nconst WebSocket = require('ws')\n\nclass MyWSController extends SomeOtherClass {\n  constructor () {\n    this.ws = new WebSocket('ws://localhost:8080')\n    this.handler = new NodeEventHandler(this, this.ws)\n  }\n\n  // These methods handle the websocket events\n  onmessage (data) {}\n  onopen () {}\n  onerror (error) {}\n  onclose () {}\n}\n```\n\n## API\n\n### `handler = new NodeEventHandler(ctx, [ee])`\n\nCreate a new instance of `NodeEventHandler` passing in a context `ctx` (often `this` when created within a class) and optionally a [Node.js style event emitter][ee] `ee` to attach listeners to on instantiation.\n\nThe `ctx` should be an object who's prototype contains event handler methods.  Event handler methods must take the form of `on${eventname}` where `eventname` is the name of the event you want to listen on and handle (the name you would pass to `ee.on(eventname)`).  In practice, you can pass a class instance as a `ctx`, or `this` when the instance owns the `NodeEventHanlder` instance.\n\n### `handler.addEventListeners(ee)`\n\nAttach all `event` handler methods on `ctx` to the [Node.js style event emitter][ee] `ee`.\n\n### `handler.removeEventListeners(ee)`\n\nRemove all `event` handler event names on `ctx` from the [Node.js style event emitter][ee] `ee`.\n\n## See also\n\nThis module is an API match to [dom-event-handler](http://github.com/bcomnes/dom-event-handler) which has a clever API, but requires the support of the [`handleEvent`](https://developer.mozilla.org/en-US/docs/Web/API/EventListener/handleEvent) on the [EventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventListener/handleEvent) interface.  Most Node.js modules have poor support for these interfaces because they are difficult to replicate outside of a browser.\n\nWhen using [dom-event-handler](http://github.com/bcomnes/dom-event-handler) in a universal context, this can be used as a stand-in on the Node.js side of things.\n\n## License\n[MIT](https://tldrlegal.com/license/mit-license)\n\n[stabilityimg]: https://img.shields.io/badge/stability-experimental-orange.svg\n[stability]: https://nodejs.org/api/documentation.html#documentation_stability_index\n[npmimg]: https://img.shields.io/npm/v/node-event-handler.svg\n[npm]: https://npmjs.org/package/node-event-handler\n[travisimg]: https://img.shields.io/travis/bcomnes/node-event-handler/master.svg\n[travis]: https://travis-ci.org/bcomnes/node-event-handler\n[downloadsimg]: http://img.shields.io/npm/dm/node-event-handler.svg\n[downloads]: https://npmjs.org/package/node-event-handler\n[standardimg]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n[standard]: https://github.com/feross/standard\n[coverallsimg]: https://img.shields.io/coveralls/bcomnes/node-event-handler/master.svg\n[coveralls]: https://coveralls.io/github/bcomnes/node-event-handler\n\n\n[ee]: https://nodejs.org/api/events.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcomnes%2Fnode-event-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcomnes%2Fnode-event-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcomnes%2Fnode-event-handler/lists"}