{"id":17327210,"url":"https://github.com/hand-dot/wkn","last_synced_at":"2025-09-07T15:38:18.957Z","repository":{"id":57398593,"uuid":"146992723","full_name":"hand-dot/wkn","owner":"hand-dot","description":"wkn makes it easy for other threads to execute processing🚀 Check Demo👉 https://jsfiddle.net/hand_dot/qjcrk6hs/30/","archived":false,"fork":false,"pushed_at":"2018-12-25T14:53:06.000Z","size":654,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-03T16:19:05.593Z","etag":null,"topics":["multithreading","thread","webworker","woker"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/wkn","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/hand-dot.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":"2018-09-01T11:27:29.000Z","updated_at":"2018-12-25T14:53:08.000Z","dependencies_parsed_at":"2022-09-12T04:42:20.458Z","dependency_job_id":null,"html_url":"https://github.com/hand-dot/wkn","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/hand-dot/wkn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hand-dot%2Fwkn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hand-dot%2Fwkn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hand-dot%2Fwkn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hand-dot%2Fwkn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hand-dot","download_url":"https://codeload.github.com/hand-dot/wkn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hand-dot%2Fwkn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264766463,"owners_count":23660771,"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":["multithreading","thread","webworker","woker"],"created_at":"2024-10-15T14:19:08.417Z","updated_at":"2025-07-17T14:08:01.530Z","avatar_url":"https://github.com/hand-dot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Build Status](https://travis-ci.org/hand-dot/wkn.svg?branch=master)](https://travis-ci.org/hand-dot/wkn)\n\n![cooltext297452362996449](https://user-images.githubusercontent.com/24843808/45003797-faebce80-b020-11e8-95c8-021c2caf9e4f.gif)\n\nwkn is easy possible to run the processing to another thread.\n  \n\n# Concept\n\n* Simple API\n* No Config\n* Light\n\n# Installing\n```bash\n$ npm install wkn\n```\n\n# Example\n```javascript  \nimport wkn from 'wkn';\n\n/**\n* Takes function and arguments, moves the processing to another thread,\n* and receives the processing result on Promise.\n* @param {Function} function to have retunrn value. (Be processed in Web Worker context)\n* @param  {...*}  [arguments] arguments\n* @returns  {Promise} Returns Processing result as Promise\n*/\n\n// Simple usage\nwkn(arg =\u003e arg + 1, 100)\n  .then((value) =\u003e {\n    console.log(value); // 101\n  });\n\n// Two arguments\nwkn((arg1, arg2) =\u003e `${arg1}!${arg2}!`, 'hoge', 'foo')\n  .then((value) =\u003e {\n    console.log(value); // hoge!foo!\n  });\n\n// Use moment.js\nwkn((years, months, days, hours, minutes, seconds) =\u003e {\n  importScripts('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.js');\n  const m = moment(new Date(years, months, days, hours, minutes, seconds));\n  return m.hours();\n}, 2011, 2, 12, 5, 0, 0)\n  .then((value) =\u003e {\n    console.log(value); // 5\n  });\n\n// Heavy processing\nwkn(() =\u003e {\n  let num = 0;\n  for (let i = 0; i \u003c 100000000; i++) {\n    num += i;\n  }\n  return num;\n})\n  .then((value) =\u003e {\n    console.log(value); // 4999999950000000\n  });\n\n// onRejected\nwkn(arg =\u003e arg.map(_ =\u003e `${_}!`), {})\n  .then((value) =\u003e {\n    console.log(value); // not fire\n  }, (reason) =\u003e {\n    console.error(reason); // arg.map is not a functio\n  });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhand-dot%2Fwkn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhand-dot%2Fwkn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhand-dot%2Fwkn/lists"}