{"id":22539446,"url":"https://github.com/biugle/js-xcall","last_synced_at":"2025-04-09T21:43:25.714Z","repository":{"id":57687083,"uuid":"476262745","full_name":"biugle/js-xcall","owner":"biugle","description":"A Simple Events Dispatcher Singleton Class. JavaScript 的一个简单的事件派发单例类 [EventBus]","archived":false,"fork":false,"pushed_at":"2024-05-17T07:17:39.000Z","size":52,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T23:35:06.161Z","etag":null,"topics":["call","dispatcher","eventbus","javascript","typescript","xcall"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/js-xcall","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/biugle.png","metadata":{"files":{"readme":"README.en.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-31T10:47:37.000Z","updated_at":"2024-05-19T15:24:43.000Z","dependencies_parsed_at":"2024-05-17T08:44:13.712Z","dependency_job_id":null,"html_url":"https://github.com/biugle/js-xcall","commit_stats":null,"previous_names":["biugle/js-xcall","pandaoh/js-xcall"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biugle%2Fjs-xcall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biugle%2Fjs-xcall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biugle%2Fjs-xcall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biugle%2Fjs-xcall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biugle","download_url":"https://codeload.github.com/biugle/js-xcall/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119341,"owners_count":21050753,"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":["call","dispatcher","eventbus","javascript","typescript","xcall"],"created_at":"2024-12-07T12:07:01.249Z","updated_at":"2025-04-09T21:43:25.685Z","avatar_url":"https://github.com/biugle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-xcall\n\nA Simple Events Dispatcher Singleton Class.\n\n## Install\n\n```bash\nnpm install js-xcall -S\n```\n\n## Import\n\n```javascript\nconst { XCall } = require('js-xcall');\nimport { XCall } from 'js-xcall';\nimport XCall from 'js-xcall';\n\n\u003cscript src=\"xcall.min.js\"\u003e\u003c/script\u003e\nconst { XCall } = $call;\nXCall.addCallBack('test', function () {\n  console.log('test-browser', arguments);\n});\n```\n\n## Use\n\n```javascript\nconsole.log(XCall);\n\nXCall.addCallBack('test', function () {\n  console.log('test1', arguments);\n});\n\nvar test = function (data1, data2) {\n  console.log('test2', data1, data2);\n};\n\nXCall.addCallBack('test', test);\n\nXCall.dispatch('test', 123, 456);\n// test1 [Arguments] { '0': 123, '1': 456 }\n// test2 123 456\n\nconsole.log(\n  'hasCallBack-test',\n  XCall.hasCallBack('test', test),\n  XCall.hasCallBack('test', () =\u003e {}),\n  XCall.existEvent('test')\n); // hasCallBack-test true false true\n\nXCall.getCount(); // 1 (event count)\n\nXCall.removeCallBack('test', test);\nXCall.existEvent('test'); // true\nXCall.getCount('test'); // 1 (callback count)\nXCall.dispatch('test'); // test1 [Arguments] {}\nXCall.deleteEvent('test');\nXCall.getCount('test'); // 0 (callback count)\nXCall.existEvent('test'); // false\n\nXCall.setOnceEvent('test-once', test);\nXCall.existEvent('test-once'); // true\nXCall.getCount('test-once'); // 1 (callback count)\nXCall.getCount(); // 1 (event count)\nXCall.dispatch('test-once');\nXCall.existEvent('test-once'); // false\n\nXCall.getCount(); // 0  (event count)\n\nXCall.dispatch('test-not'); // Error: not found test-not\n\nXCall.addCallBack('hello', test); // only one callback\nXCall.existEvent('hello'); // true\nXCall.dispatch('hello', 0, 1); // test2 0 1\nXCall.removeCallBack('hello', test); // will remove event listener\nXCall.existEvent('hello'); // false\n```\n\n## API Docs\n\n[API Docs](https://github.com/biugle/js-xcall/blob/main/docs/README.md)\n\n## Others\n\n* [Issue](https://github.com/biugle/js-xcall/issues)\n* [Pull Request](https://github.com/biugle/js-xcall/pulls)\n* [hxbpandaoh@163.com](mailto:hxbpandaoh@163.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiugle%2Fjs-xcall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiugle%2Fjs-xcall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiugle%2Fjs-xcall/lists"}