{"id":16897775,"url":"https://github.com/behnammodi/jetworker","last_synced_at":"2025-03-22T09:31:53.003Z","repository":{"id":41768438,"uuid":"161037122","full_name":"behnammodi/jetworker","owner":"behnammodi","description":"jetworker easy way for community with Web Worker","archived":false,"fork":false,"pushed_at":"2023-03-04T04:48:17.000Z","size":2300,"stargazers_count":10,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-21T15:33:21.521Z","etag":null,"topics":["javascript","jetworker","webworker"],"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/behnammodi.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}},"created_at":"2018-12-09T12:30:26.000Z","updated_at":"2022-09-20T15:12:44.000Z","dependencies_parsed_at":"2023-02-06T11:31:29.884Z","dependency_job_id":null,"html_url":"https://github.com/behnammodi/jetworker","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":0.1333333333333333,"last_synced_commit":"69e0dc86b511044d036bcdc354c1c97744a58d1c"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behnammodi%2Fjetworker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behnammodi%2Fjetworker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behnammodi%2Fjetworker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behnammodi%2Fjetworker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/behnammodi","download_url":"https://codeload.github.com/behnammodi/jetworker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244117670,"owners_count":20400744,"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":["javascript","jetworker","webworker"],"created_at":"2024-10-13T17:39:46.292Z","updated_at":"2025-03-22T09:31:52.530Z","avatar_url":"https://github.com/behnammodi.png","language":"JavaScript","readme":"## jetworker\n\n[![NPM](https://nodei.co/npm/jetworker.png)](https://nodei.co/npm/jetworker/)\n\n[![install size](https://packagephobia.now.sh/badge?p=jetworker)](https://packagephobia.now.sh/result?p=jetworker) [![dependencies](https://david-dm.org/uxitten/jetworker.svg)](https://david-dm.org/uxitten/jetworker.svg)\n\n\u003ca href=\"https://www.npmjs.com/package/jetworker\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/jetworker.svg\" alt=\"Version\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://www.npmjs.com/package/jetworker\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/jetworker.svg\" alt=\"License\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://www.npmjs.com/package/jetworker\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dm/jetworker.svg\" alt=\"Downloads\"\u003e\n\u003c/a\u003e\n\njetworker easy way for community with WebWorker\n\n### Browser compatibility desktop\n\n| Chrome | Firefox | Internet Explorer | Opera | Safari |\n| ------ | ------- | ----------------- | ----- | ------ |\n| 4      | 3.5     | 10                | 10.6  | 4      |\n\n### Browser compatibility mobile\n\n| Android | Chrome | Firefox | Internet Explorer | Opera | Safari |\n| ------- | ------ | ------- | ----------------- | ----- | ------ |\n| 4.4     | 4      | 3.5     | 10                | 11.5  | 5.1    |\n\n## install\n\n```npm\nnpm install jetworker --save\n```\n\njetwork has two section `Client` and `Service`\n\n`Client` for use in main thread website or webapp\n\n`Service` for use in WebWorker file\n\n## import Client\n\n```javascript\nconst Client = require(\"jetworker/client\");\n//or\nimport Client from \"jetworker/client\";\n```\n\n## import Service\n\n```javascript\nconst Service = require(\"jetworker/service\");\n//or\nimport Service from \"jetworker/service\";\n```\n\n## use web\n\n```javascript\nimport Client from \"jetworker/client\";\n\nconst { post } = new Client(\"./worker.js\");\n\n/**\n * post(name, data, callback)\n * @param {string} name is function name in worker\n * @param {any} data send to worker\n * @param {function} callback for recive response from worker\n * @returns {undefined} nothing\n */\npost(\"multiple\", { a: 2, b: 3 }, result =\u003e console.log(result));\n```\n\n## in worker.js\n\n```javascript\nimport Service from \"jetworker/service\";\n\nconst { on } = new Service();\n\nfunction multiple(data, response) {\n  response(data.a * data.b);\n}\n\n/**\n * service.on(name, process)\n * @param {string} name function name for call in client\n * @param {function} process function, data is data recived from client and post is function for send result to client\n */\non(\"multiple\", multiple);\n```\n\n## Migration from v1 to v2\n\nYou should use `post` instead `emit` inside client\n\n```diff\n- const { emit } = new Client(\"./worker.js\");\n+ const { post } = new Client(\"./worker.js\");\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbehnammodi%2Fjetworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbehnammodi%2Fjetworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbehnammodi%2Fjetworker/lists"}