{"id":28545145,"url":"https://github.com/moxystudio/js-pico-signals","last_synced_at":"2025-06-22T15:33:29.160Z","repository":{"id":53291762,"uuid":"172939296","full_name":"moxystudio/js-pico-signals","owner":"moxystudio","description":"A very simple signal library inspired by the 'signals' package","archived":false,"fork":false,"pushed_at":"2021-03-31T20:15:53.000Z","size":185,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-06-09T23:06:46.125Z","etag":null,"topics":["callbacks","emitters","events","listeners","observer","pico","set","signals"],"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/moxystudio.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":"2019-02-27T15:20:04.000Z","updated_at":"2025-05-06T12:56:13.000Z","dependencies_parsed_at":"2022-08-19T23:40:23.715Z","dependency_job_id":null,"html_url":"https://github.com/moxystudio/js-pico-signals","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/moxystudio/js-pico-signals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fjs-pico-signals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fjs-pico-signals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fjs-pico-signals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fjs-pico-signals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moxystudio","download_url":"https://codeload.github.com/moxystudio/js-pico-signals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fjs-pico-signals/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261314617,"owners_count":23140111,"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":["callbacks","emitters","events","listeners","observer","pico","set","signals"],"created_at":"2025-06-09T23:06:41.263Z","updated_at":"2025-06-22T15:33:29.140Z","avatar_url":"https://github.com/moxystudio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pico-signals\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]\n\n[npm-url]:https://npmjs.org/package/pico-signals\n[downloads-image]:https://img.shields.io/npm/dm/pico-signals.svg\n[npm-image]:https://img.shields.io/npm/v/pico-signals.svg\n[travis-url]:https://travis-ci.org/moxystudio/js-pico-signals\n[travis-image]:https://img.shields.io/travis/moxystudio/js-pico-signals/master.svg\n[codecov-url]:https://codecov.io/gh/moxystudio/js-pico-signals\n[codecov-image]:https://img.shields.io/codecov/c/github/moxystudio/js-pico-signals/master.svg\n[david-dm-url]:https://david-dm.org/moxystudio/js-pico-signals\n[david-dm-image]:https://img.shields.io/david/moxystudio/js-pico-signals.svg\n[david-dm-dev-url]:https://david-dm.org/moxystudio/js-pico-signals?type=dev\n[david-dm-dev-image]:https://img.shields.io/david/dev/moxystudio/js-pico-signals.svg\n\nA very simple signal library inspired by the [signals](https://github.com/millermedeiros/js-signals) package.\n\n\n## Installation\n\n```sh\n$ npm install pico-signals\n```\n\nThis library is written in modern JavaScript and is published in both CommonJS and ES module transpiled variants.\n\nIf you target older browsers please make sure to transpile accordingly. \n\n\n## Usage\n\n```js\nimport signal from 'pico-signals';\n\nconst listener1 = () =\u003e console.log('Listener1');\nconst listener2 = () =\u003e console.log('Listener2');\n\nconst mySignal = signal();\n\nconst removeListener1 = mySignal.add(listener1);\nconst removeListener2 = mySignal.add(listener2);\n\nmySignal.dispatch('foo', 'bar');\n//=\u003e Both listeners will be called and both logs produced.\n//=\u003e Every listener will receive the same arguments provided in the dispatch method.\n\nremoveListener2();\n//=\u003e Deletes `listener2` from the listeners list;\n\nmySignal.dispatch();\n//=\u003e Only `listener1` will be called since its currently the only listener on the list.\n\nmySignal.clear();\n//=\u003e Clears all listeners.\n```\n\n## API\n\n### add(listener)\n\nAdds a new listener to the list.\n\nReturns a method to remove the listener.\n\n#### listener\nType: `Function`\n\nA listener to be called on dispatch.\n\n### delete(listener)\n\nDeletes a listener from the list.\n\n#### listener\nType: `Function`\n\nAn existing listener in the list.\n\n### clear()\n\nDeletes all listeners from the list.\n\n### dispatch(...args)\n\nCalls every listener with the specified arguments.\n\n\n## Tests\n\n```sh\n$ npm test\n$ npm test -- --watch # during development\n```\n\n\n## License\n\nReleased under the [MIT License](https://www.opensource.org/licenses/mit-license.php).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxystudio%2Fjs-pico-signals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoxystudio%2Fjs-pico-signals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxystudio%2Fjs-pico-signals/lists"}