{"id":31121101,"url":"https://github.com/naecoo/funcwork","last_synced_at":"2025-09-17T15:19:41.671Z","repository":{"id":34771886,"uuid":"183580164","full_name":"naecoo/funcwork","owner":"naecoo","description":"run javascript function in web worker","archived":false,"fork":false,"pushed_at":"2024-07-18T14:14:29.000Z","size":317,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-05T02:51:51.912Z","etag":null,"topics":["javascript","web-worker","web-workers"],"latest_commit_sha":null,"homepage":"https://naecoo.github.io/funcwork/","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/naecoo.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":"2019-04-26T07:29:28.000Z","updated_at":"2024-06-27T04:44:01.000Z","dependencies_parsed_at":"2023-11-26T12:40:20.936Z","dependency_job_id":null,"html_url":"https://github.com/naecoo/funcwork","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/naecoo/funcwork","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naecoo%2Ffuncwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naecoo%2Ffuncwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naecoo%2Ffuncwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naecoo%2Ffuncwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naecoo","download_url":"https://codeload.github.com/naecoo/funcwork/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naecoo%2Ffuncwork/sbom","scorecard":{"id":672770,"data":{"date":"2025-08-11","repo":{"name":"github.com/naecoo/funcwork","commit":"ece3937550fd4c67f6a2e3a9d14c7ccd9960b1e9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T20:43:17.145Z","repository_id":34771886,"created_at":"2025-08-21T20:43:17.145Z","updated_at":"2025-08-21T20:43:17.145Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275615808,"owners_count":25496906,"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-09-17T02:00:09.119Z","response_time":84,"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":["javascript","web-worker","web-workers"],"created_at":"2025-09-17T15:19:40.580Z","updated_at":"2025-09-17T15:19:41.665Z","avatar_url":"https://github.com/naecoo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# funcwork\n[🍵](https://emojipedia.org/teacup-without-handle/) Run pure function in Web Worker easily. Allows add functions to Web Worker dynamically, there are no preset `.js` files.\n\n[online demo](https://naecoo.github.io/funcwork/)\n\n## Why\n\nThis package help you use `Web Worker` in a human way.\n\n\n\n## Install\n\n```console\nnpm i funcwork\n```\n\n\n\n## Usage\n\n### base\n\n```js\nimport { FuncWork } from 'funcwork'\n\nconst fw = new FuncWork()\nconst add = (a, b) =\u003e a + b\nfw.add(add)\n\n// The `add` function will be running in Web Worker.\n// So you can do other things in main process.\nfw.invoke(add, [1, 1]).then((result) =\u003e {\n  console.log(result) // 2\n})\n```\n\n### add multiple functions\n\n```js\nimport { FuncWork } from 'funcwork'\n\nconst fw = new FuncWork()\nconst add = (a, b) =\u003e a + b\nfunction sub(a, b) {\n  return a - b\n}\nfw.add(add, sub)\n```\n\n### invoke\n\n```js\nimport { FuncWork } from 'funcwork'\n\nconst fw = new FuncWork()\nconst add = (a, b) =\u003e a + b\nfw.add(add)\nfw.invoke(add, [1, 1]).then((result) =\u003e {\n  console.log(result) // 2\n})\n\n// or\nfw.invoke('add', [1, 2]).then((result) =\u003e {\n  console.log(result) // 3\n})\n\n// recommended way\n(async () =\u003e {\n  try {\n    const result = await fw.invoke('add', [1, 3])\n    console.log(result) // 4\n  }\n  catch (err) {\n    // It may be an exception thrown by the Web Worker, or the process of function execution\n    console.log(err)\n  }\n})()\n```\n\n### destroy\n\n```js\nimport { FuncWork } from 'funcwork'\n\nconst fw = new FuncWork()\n\n// ...\n\n// Destroy Funcwork instance, it will clear all function and terminate Web Worker instance.\nfw.destroy()\n```\n\n\n\n## API\n\n### Class\n#### Funcwork\n\n- Arguments\n\n  - options: `Web Worker` options, get detail [here](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)\n\n- Returns\n\n  `Funcwork` instance\n\n- Usage\n\n  Create `Funcwork` instance\n\n  ```js\n  import { FuncWork } from 'funcwork'\n  \n  const fw = new FuncWork()\n  // or\n  const fw = new FuncWork({\n    credentials: '',\n    name: '',\n    type: ''\n  })\n  ```\n\n  \n\n### Instance Methods\n#### add\n\n- Arguments\n\n  - { Function }\tfn\n\n- Returns\n\n  this\n\n- Usage\n\n  Add function to `Web Worker`\n\n  ```javascript\n  import { FuncWork } from 'funcwork';\n  \n  const fw = new FuncWork();\n  \n  function add (a, b) {\n      return a + b;\n  }\n  fw.add(add);\n  fw.add(function sub(a, b) { return a - b});\n  \n  \n  // multiple\n  const f3 = () =\u003e { \n  \t// ... \n  };\n  fw.add(function f1() {}, function f2, f3);\n  \n  // Chain calls\n  fw.add(function f4() {})\n     .add(function f5() {});\n  ```\n\n#### invoke\n\n- Arguments\n\n  - { string | Function }\tname\n  - { Array } params\n\n- Returns\n\n  - Promise\u003cdata\u003e\t`data` is the result returned after the function is executed\n\n- Usage\n\n  Call the registered function\n\n  ```javascript\n  import { FuncWork } from 'funcwork';\n  \n  const fw = new FuncWork();\n  \n  function add (a, b) {\n      return a + b;\n  }\n  fw.add(add);\n  \n  fw.inoke(add, [1, 2]).then(data =\u003e {\n      console.log(data); // 3\n  })\n  fw.invoke('add', [1, 3]).then(data =\u003e {\n      console.log(data); // 4\n  })\n  ```\n\n  \n\n#### remove\n\n- Arguments\n\n  - { string | Function }\tname\n\n- Returns\n\n- Usage\n\n  Remove a registered function\n\n  ```javascript\n  import { FuncWork } from 'funcwork';\n  \n  const fw = new FuncWork();\n  function add (a, b) { return a + b; }\n  fw.add(add);\n  \n  fw.remove('add');\n  // or\n  fw.remove(add)\n  \n  fw.invoke(add) // throw new Error('add is not defined in Funcwork.')\n  ```\n\n#### clear\n\n- Arguments\n\n- Returns\n\n- Usage\n\n  Clear all registered functions\n\n  ```javascript\n  import { FuncWork } from 'funcwork';\n  \n  const fw = new FuncWork();\n  function add (a, b) { return a + b; }\n  fw.add(add);\n  \n  fw.clear();\n  fw.invoke(add) // throw new Error('add is not defined in Funcwork.')\n  ```\n\n#### list\n\n- Arguments\n\n- Returns\n\n- Usage\n\n  List all registered functions\n\n  ```javascript\n  import { FuncWork } from 'funcwork';\n  \n  const fw = new FuncWork();\n  \n  function add (a, b) { return a + b; }\n  function sub(a, b) { return a - b; }\n  fw.add(add, sub);\n  fw.list(); // \"add | sub\"\n  ```\n\n#### destroy\n\n- Arguments\n\n- Returns\n\n- Usage\n\n  Clear all function and terminate Web Worker instance.\n\n  ```javascript\n  import { FuncWork } from 'funcwork';\n  \n  const fw = new FuncWork();\n  // do something...\n  \n  fw.destroy();\n  ```\n\n  \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaecoo%2Ffuncwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaecoo%2Ffuncwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaecoo%2Ffuncwork/lists"}