{"_id":"DynWorker","_rev":"9-80162181d68b53c8f922ef7897c5320f","name":"DynWorker","description":"Web threading made easy","dist-tags":{"latest":"1.2.1"},"versions":{"1.1.0":{"name":"DynWorker","version":"1.1.0","description":"Web threading made easy - Ender shortcut","keywords":["thread","webworker","worker","ender"],"homepage":"http://passcod.net/DynWorker","repository":{"type":"git","url":"git://github.com/passcod/DynWorker.git"},"ender":"ender/ender.js","main":"ender/main.js","_npmUser":{"name":"passcod","email":"me@passcod.net"},"_id":"DynWorker@1.1.0","contributors":[{"name":"Félix Saparelli","email":"me@passcod.net","url":"http://passcod.net"}],"dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.96","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"88a903f5f186670b85a253ef21d79e1d788d10cf","tarball":"https://registry.npmjs.org/DynWorker/-/DynWorker-1.1.0.tgz","integrity":"sha512-3Jjsw5wkF8Xovp3G+i+WP4+Gc+yd9giC6OhdZSyuBavuwb3Z/IiWNL1uJ12aB2vrfkn5mYb4ZpHNoa81aCdPTQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAvnPjFIThitm6d4wZ8SmGPMtWlTW/ao24Kn0wu/yMIOAiEAxVexwvZtMBeIwJ8cbmDTTVn4/i2ylhb/LMw5dzeNJO8="}]},"maintainers":[{"name":"passcod","email":"me@passcod.net"}],"directories":{},"deprecated":"this package is no longer on npm"},"1.2.1":{"name":"DynWorker","version":"1.2.1","description":"Web threading made easy","keywords":["thread","webworker","worker","ender"],"homepage":"http://passcod.net/DynWorker","repository":{"type":"git","url":"https://github.com/passcod/DynWorker.git"},"ender":"ender/ender.js","main":"ender/main.js","contributors":[{"name":"Félix Saparelli","email":"me@passcod.net","url":"http://passcod.net"}],"bugs":{"url":"https://github.com/passcod/DynWorker/issues"},"_id":"DynWorker@1.2.1","dist":{"shasum":"f06291da3bddaa40830ee3a85f63a3045a99d29d","tarball":"https://registry.npmjs.org/DynWorker/-/DynWorker-1.2.1.tgz","integrity":"sha512-cGBu8+T5zz8BL/4gkdF4qQcquZfhQ6wnNoSsAiH+pLdnXnKUosnFjnA63mAr4YFMJsDn6mvoizCdbN74K/7Q7g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDu/myLRwPgWZ+oD0hwFuoxG5Ryu9OOWRViekY1xIV89wIhAJx3EUlCcVH7akz9rAOYAGD/xPK+Qo+Tl2zTaIDJi1ks"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"passcod","email":"me@passcod.name"},"maintainers":[{"name":"passcod","email":"me@passcod.net"}],"directories":{},"deprecated":"this package is no longer on npm"}},"maintainers":[{"email":"me@passcod.name","name":"passcod"}],"time":{"modified":"2022-06-13T02:13:47.909Z","created":"2011-11-08T02:49:42.544Z","1.1.0":"2011-11-08T02:49:46.380Z","1.2.1":"2014-05-16T05:31:47.220Z"},"repository":{"type":"git","url":"https://github.com/passcod/DynWorker.git"},"readme":"[![Build Status](https://travis-ci.org/passcod/DynWorker.svg?branch=master)](https://travis-ci.org/passcod/DynWorker)\n[![NPM version](https://badge.fury.io/js/DynWorker.svg)](http://npmjs.org/package/dynworker)\n\nDynWorker\n=========\n\n\nThe Talk\n--------\n\nDynWorker is a WebWorker library which makes it easier to work with workers (haha).\nYou no longer need to create a separate file for each different worker... the only\nextra file you will ever have to load is `dynworker.js`.\n\nDynWorker contains a few utilities to augment your worker. You can easily inject\nfunctions into the worker, run arbitrary code, pass messages containing mixed\ndata (everything is JSON-encoded), and access DOM storage (local and session).\n\nDevelopment has stopped and DynWorker hasn't been updated in at least three years,\nbut it still works fine and is used in the wild. Pull requests, bug reports, and\nother questions are very welcome. Take care and have fun!\n\nThe Code\n--------\n\n```javascript\n// If the library is in the current dir and\n// is named dynworker.js, this works:\nvar worker = new DynWorker();\n\n// Otherwise you need to specify a filename,\n// but it needs to be on the same domain.\nvar worker = new DynWorker(\"/js/lib/dynworker.min.js\");\n\n// You can have a shortcut with Ender:\nvar worker = new $.worker();\n\n// You can also modify the default path once and for all:\nDynWorker.path(\"path/to/dynworker.js\");\nvar worker = new DynWorker();\n\n\n// The function is namespaced under $.ns\n// inside the worker.\nworker.inject(\"funcName\", function(arg1, arg2) {\n  var result = \"Do something awesome here\";\n  \n  // In-worker helpers are namespaced under $\n  $.receive(function(e, data) {\n    // Receive messages from the main thread\n  });\n  \n  return result;\n});\n\n// The callback gets back the raw event and the\n// parsed data\nworker.receive(function(e, data) {\n  data; // Display and strike awe\n});\n\n\n// The #run function wraps the function call in a\n// $.send() so the return value of the\n// function is sent up.\nworker.run(\"funcName\", arg1, arg2);\n\n// Hence, these two are equivalent:\nworker.run(\"funcName\");\nworker.eval(\"$.send($.ns['funcName']());\");\n```\n\n### DOM storage\n\nThe `$.localStorage` API mimics the `window.localStorage` API, minus\nthe array-like interface. Under the hood, all calls are asynchronous, but it\ndoesn't matter too much. All workers and the main thread use the same DOM\nstorage. The `$.sessionStorage` API is the same.\n\nInside the worker:\n\n```javascript\n$.localStorage.setItem(\"key\", \"data\");\n$.localStorage.getItem(\"key\", function(data) {\n  // Do something with that data\n});\n```\n\n\nThe License\n-----------\n\nDynWorker is licensed under this [MIT License](http://passcod.mit-license.org).\n","homepage":"http://passcod.net/DynWorker","keywords":["thread","webworker","worker","ender"],"contributors":[{"name":"Félix Saparelli","email":"me@passcod.net","url":"http://passcod.net"}],"bugs":{"url":"https://github.com/passcod/DynWorker/issues"},"readmeFilename":"README.markdown"}