0.2.4 • Published 2 years ago

synclink v0.2.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

Synclink

Synclink is designed to allow dispatch of work to a Worker or other browser context. It allows both asynchronous and synchronous dispatch. The synchronous dispatch is helpful because it allows async tasks to be accomplished in synchronous contexts.

For most purposes Comlink is preferable. Synclink is primarily intended for use with Pyodide.

Synclink is a fork of Comlink and as such it currently has a similar API, but there have been significant changes. Most Comlink code can be adapted fairly easily.

Example

main.js

import * as Synclink from "synclink.mjs";
function init() {
  const worker = Synclink.wrap(new Worker("worker.js"));
  let text = worker.fetch(url).syncify();
  // do something with text
}
init();

worker.js

importScripts("synclink.js");

async function fetch(url) {
  const resp = await fetch(url);
  return await resp.text();
}

Synclink.expose(obj);

License Apache-2.0

0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.4

2 years ago

0.1.1

3 years ago

0.1.0

3 years ago

4.3.0

3 years ago