remote-variable
v0.1.0
Published
Work with variable from another worker, process or javascript environment as with your variable.
Downloads
1
Readme
Remote variable
Work with variable from another worker, process or javascript environment as with your variable.
Usage
import { onRemoteVariable, connectRemoteVariable } from "remote-variable";
onRemoteVariable(postMessage, onMessage, (id, remoteVariable) => {
if (id === "document") document = remoteVariable as Document;
});
// or
const [document] = await connectRemoteVariable<Document>("document", postMessage, onMessage);
// now you can draw to remote canvas from nodejs
const canvas = document.getElementById("my-canvas");
...
import { accessVariables } from "remote-variable/client";
accessVariables("document", document, postMessage, onMessage);
Examples
$ npm run examples -- examples/canvas.ts