{"_id":"@0xbigboss/comlink-extension","_rev":"2-fd937cd1fd52744e06849083f17b589d","name":"@0xbigboss/comlink-extension","dist-tags":{"latest":"1.0.9"},"versions":{"1.0.9":{"name":"@0xbigboss/comlink-extension","version":"1.0.9","license":"MIT","_id":"@0xbigboss/comlink-extension@1.0.9","maintainers":[{"name":"0xbigboss","email":"0xbigboss@proton.me"}],"homepage":"https://github.com/0xbigboss/comlink-extension#readme","bugs":{"url":"https://github.com/0xbigboss/comlink-extension/issues"},"dist":{"shasum":"30a0275d89c4c4d6cf371829a7120df4aee994d7","tarball":"https://registry.npmjs.org/@0xbigboss/comlink-extension/-/comlink-extension-1.0.9.tgz","fileCount":11,"integrity":"sha512-jSZRbDjm/7JYI0q1dTO0lQjc8Z64Ag3PyQ9rV8j6GLmqNOcH62s3VFdFoGB7fyPcSyXUpMt10pu7ggHm1R+Meg==","signatures":[{"sig":"MEUCID8o1NQ02OcGhm+jDNYuPpUraxGae3wTdQ2/e3lZFt6dAiEAxvuiI3N2+HMDKd3g6rlAkPNFdbcrmMJn+vObZzq/8HY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16239},"main":"dist/index.js","types":"dist/index.d.ts","authors":["Sam Denty <samddenty@gmail.com>","Big Boss <bigboss@metalrodeo.xyz"],"gitHead":"1d840b7d100d2564776769350f2ba522fa166d56","scripts":{"build":"tsc"},"_npmUser":{"name":"0xbigboss","email":"0xbigboss@proton.me"},"repository":{"url":"git+https://github.com/0xbigboss/comlink-extension.git","type":"git"},"_npmVersion":"10.7.0","description":"[Forked from samdenty/comlink-extension](https://github.com/samdenty/comlink-extension). Mostly just updates typescript, formats, and republishes built files to @0xbigboss/comlink-extension.","directories":{},"_nodeVersion":"20.15.0","dependencies":{"webextension-polyfill":"^0.12.0"},"_hasShrinkwrap":false,"packageManager":"yarn@4.4.0","devDependencies":{"comlink":"^4.4.1","typescript":"5.3.3","@types/webextension-polyfill":"^0"},"_npmOperationalInternal":{"tmp":"tmp/comlink-extension_1.0.9_1722724475363_0.6917932257172299","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-08-03T22:34:35.280Z","modified":"2026-06-24T17:39:10.017Z","1.0.9":"2024-08-03T22:34:35.548Z"},"bugs":{"url":"https://github.com/0xbigboss/comlink-extension/issues"},"license":"MIT","homepage":"https://github.com/0xbigboss/comlink-extension#readme","repository":{"url":"git+https://github.com/0xbigboss/comlink-extension.git","type":"git"},"description":"[Forked from samdenty/comlink-extension](https://github.com/samdenty/comlink-extension). Mostly just updates typescript, formats, and republishes built files to @0xbigboss/comlink-extension.","maintainers":[{"email":"0xbigboss@proton.me","name":"alleneubank"}],"readme":"# Comlink for Web Extensions [![Sponsors](https://img.shields.io/github/sponsors/samdenty?label=Sponsors)](https://github.com/sponsors/samdenty)\n\n[Forked from samdenty/comlink-extension](https://github.com/samdenty/comlink-extension). Mostly just updates typescript, formats, and republishes built files to @0xbigboss/comlink-extension.\n\nThis module allows you to use [Comlink](https://github.com/GoogleChromeLabs/comlink) for `Background <-> Content/Popup` communication, in Chrome/Firefox/Safari extensions.\n\n## Usage\n\nBackground-script:\n\n```ts\nimport { createBackgroundEndpoint, isMessagePort } from \"comlink-extension\";\nimport * as Comlink from \"comlink\";\n\nchrome.runtime.onConnect.addListener((port) => {\n  if (isMessagePort(port)) return;\n\n  Comlink.expose(\n    {\n      test() {\n        console.log(\"called\");\n      },\n    },\n    createBackgroundEndpoint(port)\n  );\n});\n```\n\nContent / popup / devtool script:\n\n```ts\nimport { createEndpoint, forward } from \"comlink-extension\";\nimport * as Comlink from \"comlink\";\n\n// Wrap a chrome.runtime.Port\nconst obj = Comlink.wrap(createEndpoint(chrome.runtime.connect()));\nobj.test();\n\n// Or, wrap an existing Message Channel:\nconst { port1, port2 } = new MessageChannel();\nforward(port1, chrome.runtime.connect());\n\nconst obj = Comlink.wrap(port2);\nobj.test();\n```\n","readmeFilename":"README.md"}