Catalog npm
PACKAGE EXPLORERView in registry

@0xbigboss/comlink-extension

npm

[Forked from samdenty/comlink-extension](https://github.com/samdenty/comlink-extension). Mostly just updates typescript, formats, and republishes built files to @0xbigboss/comlink-extension.

Versions collected1
Direct dependencies4From release 1.0.9
Last observed20 Oct, 22:42 UTC

README

Current package documentation

Forked from samdenty/comlink-extension. Mostly just updates typescript, formats, and republishes built files to @0xbigboss/comlink-extension.

This module allows you to use Comlink for Background <-> Content/Popup communication, in Chrome/Firefox/Safari extensions.

Usage

Background-script:

import { createBackgroundEndpoint, isMessagePort } from "comlink-extension";
import * as Comlink from "comlink";

chrome.runtime.onConnect.addListener((port) => {
  if (isMessagePort(port)) return;

  Comlink.expose(
    {
      test() {
        console.log("called");
      },
    },
    createBackgroundEndpoint(port)
  );
});

Content / popup / devtool script:

import { createEndpoint, forward } from "comlink-extension";
import * as Comlink from "comlink";

// Wrap a chrome.runtime.Port
const obj = Comlink.wrap(createEndpoint(chrome.runtime.connect()));
obj.test();

// Or, wrap an existing Message Channel:
const { port1, port2 } = new MessageChannel();
forward(port1, chrome.runtime.connect());

const obj = Comlink.wrap(port2);
obj.test();

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.9Registry latest3 Aug 20244

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
0xbigboss/comlink-extension

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:42 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f931d05534a7f1d9ce20eae937516c0505e4969f5cf34665cef9b964a7c0e72a