{"id":15415787,"url":"https://github.com/shilangyu/anyworker","last_synced_at":"2025-04-19T14:22:45.315Z","repository":{"id":39396701,"uuid":"186114271","full_name":"shilangyu/anyworker","owner":"shilangyu","description":"Stop worrying about your Worker's environment","archived":false,"fork":false,"pushed_at":"2025-03-01T12:31:29.000Z","size":556,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T08:32:58.221Z","etag":null,"topics":["cross-platform","nodeworker","webworker","worker","worker-threads"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/shilangyu.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-11T09:39:27.000Z","updated_at":"2025-03-01T12:31:25.000Z","dependencies_parsed_at":"2023-02-17T03:15:32.853Z","dependency_job_id":"61863efa-6ee1-4059-8b5f-c333072b8ef1","html_url":"https://github.com/shilangyu/anyworker","commit_stats":{"total_commits":210,"total_committers":3,"mean_commits":70.0,"dds":0.3047619047619048,"last_synced_commit":"8a94a3b90eed6819e8db5667e3e61c8241b228dc"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shilangyu%2Fanyworker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shilangyu%2Fanyworker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shilangyu%2Fanyworker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shilangyu%2Fanyworker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shilangyu","download_url":"https://codeload.github.com/shilangyu/anyworker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249711407,"owners_count":21314231,"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":["cross-platform","nodeworker","webworker","worker","worker-threads"],"created_at":"2024-10-01T17:09:37.748Z","updated_at":"2025-04-19T14:22:45.295Z","avatar_url":"https://github.com/shilangyu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# anyworker\n\n[![](https://github.com/shilangyu/anyworker/workflows/ci/badge.svg)](https://github.com/shilangyu/anyworker/actions)\n\n```\nnpm i anyworker\n```\n\nCreates a bridge between web's WebWorker and node's worker_threads.\n\nNo more writing duplicate code for node and web targets ✨\n\nImplements:\n\n- postMessage\n- onerror\n- onmessage\n- terminate\n\nAdditionally gives such APIs as:\n\n- restart\n\n## example\n\n```ts\nimport Worker from 'anyworker'\n\nconst worker = new Worker(() =\u003e {\n\tpostMessage({ sending: ['a', 'message', 'from', 'worker'] })\n\n\tonmessage(data =\u003e console.log('hello from a worker! Master sent me:', data))\n})\n\nworker.postMessage({ sending: ['a', 'message', 'from', 'master'] })\nworker.onmessage(data =\u003e console.log('hello from master! Worker sent me:', data))\n\n// later\nworker.terminate()\n// or\nworker.restart()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshilangyu%2Fanyworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshilangyu%2Fanyworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshilangyu%2Fanyworker/lists"}