{"id":21522241,"url":"https://github.com/crapthings/react-wormhole","last_synced_at":"2025-03-17T17:23:20.954Z","repository":{"id":35052390,"uuid":"200814370","full_name":"crapthings/react-wormhole","owner":"crapthings","description":"This hoc open a tunnel between react component.","archived":false,"fork":false,"pushed_at":"2023-01-04T06:24:21.000Z","size":30,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T09:39:53.907Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crapthings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-06T08:56:34.000Z","updated_at":"2023-03-04T05:56:42.000Z","dependencies_parsed_at":"2023-01-15T12:49:24.261Z","dependency_job_id":null,"html_url":"https://github.com/crapthings/react-wormhole","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crapthings%2Freact-wormhole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crapthings%2Freact-wormhole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crapthings%2Freact-wormhole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crapthings%2Freact-wormhole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crapthings","download_url":"https://codeload.github.com/crapthings/react-wormhole/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244075655,"owners_count":20393980,"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-11-24T01:09:44.429Z","updated_at":"2025-03-17T17:23:20.924Z","avatar_url":"https://github.com/crapthings.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### how to use\n\n\u003e the wrapped class component will have a wormhole method. it can access all methods and state, prop etc...\n\n```js\nthis.wormhole()\nthis.wormhole('namespace')\nthis.wormhole(['namespace1', 'namespace2'])\n```\n\n```jsx\nimport React, { Component } from 'react'\nimport { render } from 'react-dom'\nimport withWormhole from '../dist'\n\n@withWormhole('root')\nclass Root extends Component {\n  state = {\n    ts: Date.now()\n  }\n\n  componentWillUpdate() {\n    this.wormhole('changeRootTs').setState({ ts: Date.now() })\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003ch3\u003eRoot\u003c/h3\u003e\n        \u003cdiv\u003e{this.state.ts}\u003c/div\u003e\n        \u003cNest /\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n\nclass Nest extends Component {\n  componentDidMount() {\n    console.log('Nest')\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003ch3\u003eNest\u003c/h3\u003e\n        \u003cNest1 /\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n\nclass Nest1 extends Component {\n  componentDidMount() {\n    console.log('Nest1')\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003ch3\u003eNest1\u003c/h3\u003e\n        \u003cNest2 /\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n\n@withWormhole('changeRootTs')\nclass Nest2 extends Component {\n  state = {\n    ts: null\n  }\n\n  onClick = evt =\u003e {\n    this.wormhole('root').setState({ ts: Date.now() })\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003ch3\u003eNest2\u003c/h3\u003e\n        \u003cbutton onClick={this.onClick}\u003eChange Root Timestamp {this.state.ts}\u003c/button\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n\nrender(\u003cRoot /\u003e, document.getElementById('root'))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrapthings%2Freact-wormhole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrapthings%2Freact-wormhole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrapthings%2Freact-wormhole/lists"}