{"id":13850237,"url":"https://github.com/deebloo/worker-swarm","last_synced_at":"2025-04-15T18:30:38.833Z","repository":{"id":40310114,"uuid":"254124374","full_name":"deebloo/worker-swarm","owner":"deebloo","description":"A small library to help distribute work across a pool of workers","archived":false,"fork":false,"pushed_at":"2025-04-10T12:30:56.000Z","size":13216,"stargazers_count":5,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T13:53:11.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/deebloo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-08T15:18:45.000Z","updated_at":"2021-10-14T18:59:02.000Z","dependencies_parsed_at":"2023-01-22T11:45:38.235Z","dependency_job_id":"57b74942-76d0-4eab-afe1-91332583576d","html_url":"https://github.com/deebloo/worker-swarm","commit_stats":{"total_commits":125,"total_committers":4,"mean_commits":31.25,"dds":"0.33599999999999997","last_synced_commit":"f5bc21d2efad337a2c0ac50c9cdf19dd4edda3f5"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deebloo%2Fworker-swarm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deebloo%2Fworker-swarm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deebloo%2Fworker-swarm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deebloo%2Fworker-swarm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deebloo","download_url":"https://codeload.github.com/deebloo/worker-swarm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249128878,"owners_count":21217234,"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-08-04T20:01:01.931Z","updated_at":"2025-04-15T18:30:38.557Z","avatar_url":"https://github.com/deebloo.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Worker Swarm\n\nA small library to help distribute work across a pool of workers\n\n```\nnpm i worker-swarm\n```\n\n### worker.js\n\n```TS\nself.onmessage = (e) =\u003e {\n  self.postMessage({\n    jobId: e.data.jobId, // send the job id back to complete a task\n    message: 'RESPONSE FROM ANOTHER THREAD'\n  })\n}\n```\n\n### UI Thread\n\n```TS\nimport { WorkerSwarm } from 'worker-swarm';\n\n// Create 3 instances of the worker\nconst swarm = new WorkerSwarm(() =\u003e new Worker('./worker.js'), 3);\n\n// Will go to first worker\nswarm.post({}).then((res) =\u003e {\n    console.log(res)\n});\n\n// Will go to the second worker\nswarm.post({}).then((res) =\u003e {\n    console.log(res)\n});\n\n// Will go to the third worker\nswarm.post({}).then((res) =\u003e {\n    console.log(res)\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeebloo%2Fworker-swarm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeebloo%2Fworker-swarm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeebloo%2Fworker-swarm/lists"}