{"id":19176687,"url":"https://github.com/one20/dispatch-manager","last_synced_at":"2026-04-21T03:32:04.029Z","repository":{"id":57212926,"uuid":"86853031","full_name":"one20/dispatch-manager","owner":"one20","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-09T22:14:57.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T12:56:00.818Z","etag":null,"topics":["dispatcher","event","events","flux","listener","react","reactjs"],"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/one20.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":null,"security":null,"support":null}},"created_at":"2017-03-31T19:22:11.000Z","updated_at":"2017-04-02T01:59:35.000Z","dependencies_parsed_at":"2022-08-24T21:01:28.597Z","dependency_job_id":null,"html_url":"https://github.com/one20/dispatch-manager","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/one20/dispatch-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Fdispatch-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Fdispatch-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Fdispatch-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Fdispatch-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/one20","download_url":"https://codeload.github.com/one20/dispatch-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Fdispatch-manager/sbom","scorecard":{"id":706832,"data":{"date":"2025-08-11","repo":{"name":"github.com/one20/dispatch-manager","commit":"3a45df642f58e8a532b13e3c2f26b693c7a90e8b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"Code-Review","score":0,"reason":"Found 0/9 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":"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":"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":"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":"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":"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":"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":"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-22T06:51:55.622Z","repository_id":57212926,"created_at":"2025-08-22T06:51:55.623Z","updated_at":"2025-08-22T06:51:55.623Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32075227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: 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":["dispatcher","event","events","flux","listener","react","reactjs"],"created_at":"2024-11-09T10:29:33.333Z","updated_at":"2026-04-21T03:32:04.012Z","avatar_url":"https://github.com/one20.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DispatchManager\n\n## Contents\n* [Summary](#summary)\n* [Install](#install)\n* [Quick Start](#quick-start)\n* [Methods](#methods)\n* [Example](#example)\n\n## Summary\n`DispatchManager` is a module that makes working with events in React faster/easier. The goal is to have a single module that coordinates events between different components throughout your application.\n`DispatchManager` uses `Dispatcher` instances from [flux](https://facebook.github.io/flux/docs/dispatcher.html) to organize your components' listeners by action.\n\n## Install\n`npm install --save dispatch-manager`\n\n## Quick Start\nAdd the dispatch manager to your code\n```javascript\nconst DispatchManager = require('dispatch-manager');\n```\n\nRegister any listeners. First parameter is an action, use any string identifier. Second parameter is a function that will get called any time the action is dispatched.\n```javascript\nDispatchManager.register('some_action', myListener);\nfunction myListener(payload){\n  console.log(payload);\n}\n```\n\nCall dispatch to trigger any functions listening to the same action. First parameter is the action (string identifier), second parameter is any data that you want to pass to listeners.\n```javascript\nDispatchManager.dispatch('some_action', { hello: 'world' });\n```\n## Methods\n\n| **register**( action:```string```, listener:```function``` ):```string```     |\n| :---------------------------------------------------------------------------- |\n| Registers a function to be called when the specified action is dispatched. Returns a string token which can later be used to unregister the listener.    |\n\n| **unregister**( action:```string```, token:```string``` ):```boolean```       |\n| :---------------------------------------------------------------------------- |\n| Unregisters a listener from the dispatcher associated with the specified action. Returns false if there is no dispatcher associated with the action.    |\n\n\n| **dispatch**( action:```string```*[, payload:```object```]* ):```boolean```   |\n| :---------------------------------------------------------------------------- |\n| Triggers all listeners associated with the specified action. Optional payload as a second argument, accessed by the listener as the first parameter.    |\n\n| **getDispatcher**( action:```string``` ):```Dispatcher```   |\n| :---------------------------------------------------------------------------- |\n| Returns the dispatcher object assigned to the specified action. Returns ```false``` if it doesn't exist.   |\n\n## Example\n*(Note: There is a working example that can be found in the 'example' folder. It was created using [create-react-app](https://github.com/facebookincubator/create-react-app), just run `npm start` within the folder.)*\n\nThis is an example of how multiple components can listen for the same event triggered by any component. Assume that our react application structure is the following:\n```\nindex.js\n  - ComponentA.js\n  - ComponentB.js\n    - ComponentC.js\n```\n---\nindex.js\n```javascript\nconst React = require('react');\nconst ReactDOM = require('react-dom');\nconst ComponentA = require('./ComponentA');\nconst ComponentB = require('./ComponentB');\n\nclass App extends React.Component {\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003cComponentA/\u003e\n        \u003cComponentB/\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nReactDOM.render( \u003cApp/\u003e, document.getElementById('root') );\n```\n---\nComponentA.js\n```javascript\nconst React = require('react');\nconst DispatchManager = require('dispatch-manager');\n\nclass ComponentA extends React.Component {\n  constructor(props){\n    super(props);\n\n    this.state = {\n      actionHappened: false\n    }\n\n    /* \n    * Tell DispatchManager this component wants to know \n    * whenever 'some-action' is triggered in the app. \n    * When that happens, call onSomeAction().\n    */\n    DispatchManager.register( 'some-action', this.onSomeAction.bind(this) );\n  }\n  onSomeAction(){\n    this.setState({ actionHappened : true });\n  }\n  render(){\n    let message = (this.state.actionHappened) ? 'Some action happened!' : 'Listening for some action...' ;\n    return (\n      \u003cdiv\u003eA: {message}\u003c/div\u003e\n    );\n  }\n}\n\nmodule.exports = ComponentA;\n```\n---\nComponentB.js\n```javascript\nconst React = require('react');\nconst DispatchManager = require('dispatch-manager');\nconst ComponentC = require('./ComponentC');\n\nclass ComponentB extends React.Component {\n  constructor(props){\n    super(props);\n\n    this.state = {\n      actionHappened: false\n    }\n\n    /* \n    * Tell DispatchManager this component also wants to know \n    * whenever 'some-action' is triggered in the app. \n    * When that happens, call onSomeAction().\n    */\n    DispatchManager.register( 'some-action', this.onSomeAction.bind(this) );\n  }\n  onSomeAction(){\n    this.setState({ actionHappened : true });\n  }\n  render(){\n    let message = (this.state.actionHappened) ? 'Some action happened!' : 'Listening for some action...' ;\n    return (\n      \u003cdiv\u003e\n        \u003cdiv\u003eB: {message}\u003c/div\u003e\n        \u003cComponentC/\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nmodule.exports = ComponentB;\n```\n---\nComponentC.js\n```javascript\nconst React = require('react');\nconst DispatchManager = require('dispatch-manager');\n\nclass ComponentC extends React.Component {\n    onButtonClick() {\n      /*\n      * When the button is clicked, tell DispatchManager \n      * to tell any components listening to 'some-action'.\n      * When dispatching, you can also pass data as the second\n      * argument, which can be accessed as a parameter in the listeners.\n      *\n      * e.g DispatchManager.dispatch( 'some-action', { foo: 'bar' } );\n      */\n      DispatchManager.dispatch('some-action');\n    }\n    render() {\n        return (\n            \u003cdiv\u003e\n                C: \u003cinput type=\"button\" onClick={this.onButtonClick.bind(this)} defaultValue=\"DO 'some-action' !\" /\u003e\n            \u003c/div\u003e\n        );\n    }\n}\n\nmodule.exports = ComponentC;\n```\n---\n**Result**\n\nClicking the button on ComponentC should display 'Some action happened!' on both ComponentA \u0026 ComponentB.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fone20%2Fdispatch-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fone20%2Fdispatch-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fone20%2Fdispatch-manager/lists"}