Skip to content

Instantly share code, notes, and snippets.

@ShopifyEng
Created November 30, 2021 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShopifyEng/6424c586d24007d56c9323178399bf6e to your computer and use it in GitHub Desktop.
Save ShopifyEng/6424c586d24007d56c9323178399bf6e to your computer and use it in GitHub Desktop.
Remote Rendering: Shopify’s Take on Extensible UI - Basic example setting up a `RemoteReceiver` to work together with a `RemoteRoot`
// Host
import { createEndpoint } from "@remote-ui/rpc";
import { createRemoteReceiver } from "@remote-ui/core";
const endpoint = createEndpoint(new Worker("./extension.js"));
const receiver = createRemoteReceiver();
receiver.on("mount", () => {
const remoteRoot = receiver.attached.root;
// Render the remote tree using native UI components ...
});
endpoint.call.render(receiver.receive);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment