{"id":15697489,"url":"https://github.com/kt3k/event-hub","last_synced_at":"2025-03-30T13:44:54.593Z","repository":{"id":30904032,"uuid":"34461825","full_name":"kt3k/event-hub","owner":"kt3k","description":"A dom which works as an event hub","archived":false,"fork":false,"pushed_at":"2017-06-10T11:12:52.000Z","size":224,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T16:07:44.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/kt3k.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":"2015-04-23T14:38:18.000Z","updated_at":"2017-01-02T12:05:01.000Z","dependencies_parsed_at":"2022-08-30T16:20:12.262Z","dependency_job_id":null,"html_url":"https://github.com/kt3k/event-hub","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Fevent-hub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Fevent-hub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Fevent-hub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Fevent-hub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kt3k","download_url":"https://codeload.github.com/kt3k/event-hub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246326600,"owners_count":20759436,"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":[],"created_at":"2024-10-03T19:20:24.010Z","updated_at":"2025-03-30T13:44:54.577Z","avatar_url":"https://github.com/kt3k.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# event-hub v6.2.2\n\n\u003e event hub on a dom tree\n\n[![CircleCI](https://circleci.com/gh/kt3k/event-hub.svg?style=svg)](https://circleci.com/gh/kt3k/event-hub)\n\n***note*** `event-hub` depends on [classcaps](https://github.com/kt3k/classcaps).\n\n# Usage\n\n```html\n\u003cscript src=\"path/to/class-component.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"path/to/event-hub.js\"\u003e\u003c/script\u003e\n\n\n\u003cdiv class=\"event-hub\" channel=\"click\"\u003e\n\n    \u003cdiv\u003eDIV 1\u003c/div\u003e\n\n    \u003cdiv class=\"sub-click\"\u003eDIV 2\u003c/div\u003e\n\n    \u003cdiv\u003eDIV 3\u003c/div\u003e\n\n\u003c/div\u003e\n```\n\nThe `channel` attribute specify which events are the channel of the `.event-hub`. (If you want to set multiple channels, set them like `click mouseover` (in space-separated form)).\n\nThe `sub-click` class on the 2nd element in the `.event-hub` means that it subscribes to `click` event of the `.event-hub`.\n\nWith the above settings, all the `click` events which occur under the `.event-hub` is published to the 2nd div.\n\nSee the [DEMO](https://kt3k.github.io/event-hub/test.html).\n\n# API\n\n```html\n\u003ctag class=\"event-hub\" channel=\"ch0 ch1 ... ch_N\"\u003e\u003c/tag\u003e\n```\n\n- @class `event-hub` is the component name. You need to specify the class name in dom.\n- @param {string[]} ch0, ch1,..., ch_N The channel which the event hub brokes.\n\nIf the event `ch_i` bubbles up to the above `event-hub` dom, then it dispatches the event to its children which has `sub-ch_i` class in it.\n\n## Node API\n\nYou need to call `def` of classcaps to use event-hub.\n\n```js\nconst { def } = require('classcaps')\nconst EventHub = require('event-hub')\n\ndef('event-hub', EventHub)\n```\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkt3k%2Fevent-hub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkt3k%2Fevent-hub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkt3k%2Fevent-hub/lists"}