{"id":24379713,"url":"https://github.com/y-js/y-webworker","last_synced_at":"2025-10-12T09:41:41.883Z","repository":{"id":57402704,"uuid":"73823205","full_name":"y-js/y-webworker","owner":"y-js","description":"Web Worker Connector for Yjs (enables communication with a Web Worker)","archived":false,"fork":false,"pushed_at":"2017-03-03T17:16:47.000Z","size":27,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-08T16:45:45.980Z","etag":null,"topics":["yjs","yjs-connector"],"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/y-js.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":"2016-11-15T14:49:02.000Z","updated_at":"2024-05-25T07:23:43.000Z","dependencies_parsed_at":"2022-09-11T06:51:29.915Z","dependency_job_id":null,"html_url":"https://github.com/y-js/y-webworker","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/y-js/y-webworker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-webworker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-webworker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-webworker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-webworker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/y-js","download_url":"https://codeload.github.com/y-js/y-webworker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-js%2Fy-webworker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010943,"owners_count":26084837,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["yjs","yjs-connector"],"created_at":"2025-01-19T07:18:53.280Z","updated_at":"2025-10-12T09:41:41.866Z","avatar_url":"https://github.com/y-js.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web Worker Connector for [Yjs](https://github.com/y-js/yjs)\n\nIt enables communication with a [SharedWorker](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/SharedWorker) thread.\nThe Shared Worker can handle connections, and save changes using a persistent database (e.g. [y-indexeddb](https://github.com/y-js/y-indexeddb)),\nwhile the clients connect to the shared worker leveraging improved performance. You can also set it up to perform background tasks in the Shared Worker.\n\nIn the future you may want set up a [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)\nthat keeps the Shared Worker running even after the page is closed - thus enabling synchronization after the page is closed. But this is not yet supported - [see issue](https://github.com/whatwg/html/issues/411)\n\n* Only the Shared Worker connects to the server / other clients (less connection overhead)\n* Works best with y-indexeddb\n* Faster start-up when multiple windows are open\n* Background tasks\n\n## Use it!\nRetrieve this with bower or npm.\n\n##### NPM\n```bash\nnpm install y-webworker --save\n```\n\n##### Bower\n```bash\nbower install y-webworker --save\n```\n\n### Example\n\n```javascript\n// Connect to the web worker\nY({\n  db: {\n    name: 'memory'\n  },\n  connector: {\n    name: 'webworker',\n    url: '/bower_components/y-webworker/yjs-webworker.js',\n    room: 'my room name'\n  },\n  sourceDir: '/bower_components', // location of the y-* modules\n  share: {\n    textarea: 'Text' // y.share.textarea is of type Y.Text\n  }\n}).then(function (y) {\n  // bind the textarea to a shared text element\n  y.share.textarea.bind(document.getElementById('textfield'))\n}\n```\n\n##### Modify yjs-webworker.js\nThe default behavior of `yjs-webworker.js` is to use y-indexeddb, and connect to the default server using y-websockets-client.\nFor productive systems you should copy \u0026 modify the file for your set-up. \n\n## License\n[y-webworker](https://github.com/y-js/y-webworker) is licensed under the [MIT License](./LICENSE).\n\n\u003ckevin.jahns@rwth-aachen.de\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-js%2Fy-webworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fy-js%2Fy-webworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-js%2Fy-webworker/lists"}