{"_id":"@bestyled/comlink-ipc","_rev":"4-ada880d419aa98cca46b08dcb40f88fd","name":"@bestyled/comlink-ipc","dist-tags":{"latest":"1.0.9"},"versions":{"1.0.7":{"name":"@bestyled/comlink-ipc","version":"1.0.7","description":"BeStyled's comlink-ipc makes WebWorkers, Sockets, named pipes and other IPC enjoyable","main":"dist/cjs/comlink.js","ts:main":"src/comlink.ts","types":"src/comlink.ts","license":"Apache-2.0","scripts":{"build":"rm -rf dist && tsc"},"dependencies":{},"devDependencies":{"typescript":"4.0.5"},"peerDependencies":{},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/bestyled/comlink-ipc.git"},"bugs":{"url":"https://github.com/bestyled/comlink-ipc/issues"},"homepage":"https://github.com/bestyled/comlink-ipc#readme","_id":"@bestyled/comlink-ipc@1.0.7","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-yM+LrL8C2bOncwCWF9bwoGpIMN+8H2m3c1EC9f3fLgAy+rWDd9oDhdVdUE0jWnEO9wmJZM5OUS3JPUBc7sMH9Q==","shasum":"44a8c73393831a18bb19bc921fde8781b7ad5142","tarball":"https://registry.npmjs.org/@bestyled/comlink-ipc/-/comlink-ipc-1.0.7.tgz","fileCount":17,"unpackedSize":52504,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuVlqCRA9TVsSAnZWagAAifkP/2fAAwqvjbL8lovl0NWP\nFdhgpgMjkteyw1e7D2uGtYTYQT1IMuMMP/6jPSZsbkbKDiFsbqDU7cvUvuxt\nUZAxZ1ipG43Uzb3nWPxiGu54tbP8d27P8giW1x3rWAbulBs4JipGEJXhinrA\naNLeK9iFpfzMDi+B6nmGt2iUEWMDJrNJH4jztDkXbrd0DAQ3BBB5n3gIyQD9\nn+QrjRFHl4AzOIDtRlIf5OIb+j/eoZWgRL2E+4ly283bnS/RzABXSBYoaOwI\nJW/1uKruuHkoxgo30npUkJh/35QxsK28HtxBDaHP2rHdfyznjf3yBnYgQ7g+\nmMk98aHhFsj8v75soKFmEaCNULY4kJt3wizvy3pV5xTCdeM+xRTLELDa2aON\n9CigqtHxL1IrdLTUHBHJEdf5nivBDbyZuPEUlVMBLmdINYg5nHD0XwIG06Tp\nxxK6vaLtSuq0WecIyQgrS97//t51ErZW3FZiAz9BwJgvYJ/IwXkWXfMllbYC\no4nGxZQdCY7/ZHGKdiJ8rud+E8o/eISrQH9bRA9ZwfoFOs1sLfUBwneZG292\n177CHp2RiRvjzwchtjAQ+FeEbl9uI0FjEwQ2wZ9NgZ5cdTuTsC58GIRz2rjz\nnL9VPEaCSVyXpSRvShe9DLMdGqWnqvrfaP7+KKUSpy2OQvNnYrSHBCKHh/9m\nr/h0\r\n=doyH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDCkUUyixfmgYdAE+wEnCPF4B3d8xD2ds9C6nMeKZRmdAiBfPWovhQFSc85270y91/odgWhNLYzuaH4Sj2FuseWsog=="}]},"_npmUser":{"name":"guycreate","email":"guy@nodekit.io"},"directories":{},"maintainers":[{"name":"guycreate","email":"guy@nodekit.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/comlink-ipc_1.0.7_1605982570511_0.9318310925243236"},"_hasShrinkwrap":false},"1.0.8":{"name":"@bestyled/comlink-ipc","version":"1.0.8","description":"BeStyled's comlink-ipc makes WebWorkers, Sockets, named pipes and other IPC enjoyable","main":"dist/cjs/comlink.js","ts:main":"src/comlink.ts","types":"src/comlink.ts","license":"Apache-2.0","scripts":{"build":"rm -rf dist && tsc"},"dependencies":{},"devDependencies":{"typescript":"4.0.5"},"peerDependencies":{},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/bestyled/comlink-ipc.git"},"bugs":{"url":"https://github.com/bestyled/comlink-ipc/issues"},"homepage":"https://github.com/bestyled/comlink-ipc#readme","_id":"@bestyled/comlink-ipc@1.0.8","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-YxpUsTeGbPs++ZDWfzQnmy4E7CdbVf21cMWTOHbwjBO6VXtZ1R192K2swCsxP0R6iXhccLTi83LD7cvxCWdsGA==","shasum":"92ed5df7b7b2fecea3b59513cfb900d78c7f5fd6","tarball":"https://registry.npmjs.org/@bestyled/comlink-ipc/-/comlink-ipc-1.0.8.tgz","fileCount":17,"unpackedSize":52504,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuVmhCRA9TVsSAnZWagAAf5UP/i7Hi2srl2A7AoSyTyjB\njpTYf7Aci4Sv3mr4LMenKnqRyOBhFk1UPMTGy4WM512Zfr7J9Xc88wxcB/rj\nsVInBPGuFu1WXKHUQwWosUV18ky/OHrLPq2OuwPwaEUZryqVCBe6xMaPzx3f\nuzS3EBPNqFx0aX6ncN107L4iW3HTivvCUoJYlLPnohc3Kkri/gBvQ3276HUk\ndofYnHV7k1fFx8fyzhG84gruyCbK8CCcywDT/yj2EYmzWfwOPJjfITkZOoQ1\nBI6ShnIhppG+QwhKr4ZY5T2Ae3J2K5gIm+yFMja0wBh7iQgo1aQgUlySgkCS\nUqTZxyldU1Lz1iusrNKLsCw4EQbphRraWDu2Nmhsyd8EBEtvIMj0MrHr7X9J\nqED55O+lSGKI+3hB+rHGlmMxjkeyyS13RKOvwmxJ9NE1LvJuEK0vqiJKCdL+\na3SKcKpz14VdjLQVCzt55PUrCPFzPVetPDjPpsR3OPnd8Lv9W8BttThQUXmT\nYvX1EnL1CnZFF4ai3wpgoawECmGU7Ly8VqstPairIctVFNyBc8v8MJevmHQq\nTNKP32lYRjaeOxQEz7v4UxZIPvB6nzm2SiMTLFwM0gWtixSq6zgXplNKoqCI\n1Rh+B6Dpa4fLxRa1h3aO1YCfILPuf/90dWl1GaWBnfO65G6TrvYaPfA+5BmB\nmMzD\r\n=VA0n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAiXjY1St1KcNubADVxNcSs+Ich1uTcHQtEavYgd9dygAiEA60a5s+YojUGB7nrEjNrc8Wghm9tGmIH5Mja/CNqQ4FA="}]},"_npmUser":{"name":"guycreate","email":"guy@nodekit.io"},"directories":{},"maintainers":[{"name":"guycreate","email":"guy@nodekit.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/comlink-ipc_1.0.8_1605982625147_0.3276660755053864"},"_hasShrinkwrap":false},"1.0.9":{"name":"@bestyled/comlink-ipc","version":"1.0.9","description":"BeStyled's comlink-ipc makes WebWorkers, Sockets, named pipes and other IPC enjoyable","main":"dist/cjs/comlink.js","ts:main":"src/comlink.ts","types":"src/comlink.ts","license":"Apache-2.0","scripts":{"build":"rm -rf dist && tsc"},"dependencies":{},"devDependencies":{"typescript":"4.0.5"},"peerDependencies":{},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/bestyled/comlink-ipc.git"},"bugs":{"url":"https://github.com/bestyled/comlink-ipc/issues"},"homepage":"https://github.com/bestyled/comlink-ipc#readme","_id":"@bestyled/comlink-ipc@1.0.9","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-KtnlpSQ4zCwoYeVPYZ73oQkD/5bWpY7yICcijsvrqTqWZ7sXyuQSgy+Th7Sv15/dZZ9UtBNZbTEZ/j6yo18+SA==","shasum":"52999e2961699c65a8598bb5f210bf96cdb55b0b","tarball":"https://registry.npmjs.org/@bestyled/comlink-ipc/-/comlink-ipc-1.0.9.tgz","fileCount":17,"unpackedSize":52504,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuVngCRA9TVsSAnZWagAATfwP/3aK+9nen/hUL/859W+9\nQZlJ1TR+VI2KIIs7m8VJJIcqYJmoyconryHfdaJsJ3TUqaigxo68rZLIei2s\n9NeSSeOx0lMjmJB3j1zIW1BeMq69JZExmKTe/PflENjJO5zw1J/KFy6MdIL2\nBHFjbTsAZq2CUqZsSDWkzqxUSfMxoeGQzx8OskMQ3yQfwIpvr2Lh+VwM332Q\n0eaOwjVjDAVqVZhTY7Ob8r63syeM9c9k3J18yQSHwKnEN8R+Mp6jDQiB+hc4\nQ+JFO6cxMV16gStYDK5OjZgBLlqZdj8rz0/ezX1Iny3mzSwTP+7+A/CduPQX\nOjLob8pdzU3Kec9YEKZUNU9uF7E1E+avRFiBMXPCzc4wr0dXiSIcHWBMiqMJ\ny3CvVHsMZb7HUCVhHh1N1xq9lcMpuUGVVbW39UyctRR4lSqRFxNU0r4tNClh\n6uxkP+46P8/l1s2EtQDDnil7+3ndN5Yao5tYHcIST4HFY9OaMg+LeWQLh644\nZ/62GWe63aGIwMySExxP/L1qkiOat7cP3MsU9KZiNAwcoPddVbXL81Up6nW6\n3nstmZZWcz2WNh6D8fPga+F5MoH4+viDWPGhhSk9XXAFcfa3wul9y1g8cn8G\nkHK75x2yg3TK/ZYnFtGNzu8ooL7fsj8EKzHQ5zeTobofNwlrvnwjwB2Ty6QL\n8VgO\r\n=C9Yw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBRQdELA3Qe0vpw3jcw8CC1ahnQse3Z0uAA53RTOTQQaAiEA1OCD4PFLSy0VXWVwHMxQDqIvzilqZhkyoQNQqDbHcDQ="}]},"_npmUser":{"name":"guycreate","email":"guy@nodekit.io"},"directories":{},"maintainers":[{"name":"guycreate","email":"guy@nodekit.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/comlink-ipc_1.0.9_1605982687559_0.4108643771911198"},"_hasShrinkwrap":false}},"time":{"created":"2020-11-21T18:16:10.462Z","1.0.7":"2020-11-21T18:16:10.635Z","modified":"2022-04-04T18:33:52.875Z","1.0.8":"2020-11-21T18:17:05.401Z","1.0.9":"2020-11-21T18:18:07.729Z"},"maintainers":[{"email":"admin@tinia.org","name":"tinialabs1"},{"email":"guy-nodekit@barnardmail.net","name":"guycreate"}],"description":"BeStyled's comlink-ipc makes WebWorkers, Sockets, named pipes and other IPC enjoyable","homepage":"https://github.com/bestyled/comlink-ipc#readme","repository":{"type":"git","url":"git+https://github.com/bestyled/comlink-ipc.git"},"bugs":{"url":"https://github.com/bestyled/comlink-ipc/issues"},"license":"Apache-2.0","readme":"# comlink-ipc\n\n## Fork\nForked from GoogleChromeLabs/comlink to remove dependency on browser webworkers and MessageChannel and use more generically indepdent of transport.\n\n## API\n\n### `Comlink.wrap(endpoint)` and `Comlink.expose(value, endpoint?)`\n\nComlink’s goal is to make _exposed_ values from one thread available in the other. `expose` exposes `value` on `endpoint`, where `endpoint` is a [`postMessage`-like interface][endpoint].\n\n`wrap` wraps the _other_ end of the message channel and returns a proxy. The proxy will have all properties and functions of the exposed value, but access and invocations are inherently asynchronous. This means that a function that returns a number will now return _a promise_ for a number. **As a rule of thumb: If you are using the proxy, put `await` in front of it.** Exceptions will be caught and re-thrown on the other side.\n\nLastly, you can use `Comlink.proxy(value)`. When using this Comlink will not copy the value, but instead send a proxy. Both threads now work on the same value. This is useful for callbacks, for example, as functions are not structured cloneable.\n\n```js\nmyProxy.onready = Comlink.proxy(data => {\n  /* ... */\n});\n```\n\n### Transfer handlers and event listeners\n\nIt is common that you want to use Comlink to add an event listener, where the event source is on another thread:\n\n```js\nbutton.addEventListener(\"click\", myProxy.onClick.bind(myProxy));\n```\n\nWhile this won’t throw immediately, `onClick` will never actually be called. This is because [`Event`][event] is neither structured cloneable nor transferable. As a workaround, Comlink offers transfer handlers.\n\nEach function parameter and return value is given to _all_ registered transfer handlers. If one of the event handler signals that it can process the value by returning `true` from `canHandle()`, it is now responsible for serializing the value to structured cloneable data and for deserializing the value. A transfer handler has be set up on _both sides_ of the message channel. Here’s an example transfer handler for events:\n\n```js\nComlink.transferHandlers.set(\"EVENT\", {\n  canHandle: obj => obj instanceof Event,\n  serialize: ev => {\n    return [{\n      target: {\n        id: ev.target.id\n        classList: [...ev.target.classList]\n      }\n    }, []];\n  },\n  deserialize: obj => obj,\n});\n```\n\nNote that this particular transfer handler won’t create an actual `Event`, but just an object that has the `event.target.id` and `event.target.classList` property. Often, this enough. If not, the transfer handler can be easily augmented to provide all necessary data.\n\n---\n\nLicense Apache-2.0\n","readmeFilename":"README.md"}