diff --git a/README.md b/README.md index 85ca26f5..be420556 100644 --- a/README.md +++ b/README.md @@ -205,18 +205,17 @@ First, we’ll create the remote environment’s version of `ui-button`. The rem // which is a small library that was designed to work well with Remote DOM. import {RemoteMutationObserver} from '@remote-dom/core/elements'; - import {createThreadFromInsideIframe, retain} from '@quilted/threads'; + import {ThreadNestedWindow} from '@quilted/threads'; const root = document.querySelector('#root'); - createThreadFromInsideIframe({ - expose: { + new ThreadNestedWindow({ + exports: { // This `render()` method will kick off the process of synchronizing // changes between environments. It will be called on the host with a // `RemoteConnection` object, which you’ll generally get from one of // Remote DOM’s `Receiver` classes. - render(connection) { - retain(connection); + async render(connection) { const observer = new RemoteMutationObserver(connection); observer.observe(root); }, @@ -290,7 +289,7 @@ Finally, we need to provide a “real” implementation of our `ui-button` eleme diff --git a/documentation/migrations/remote-ui-to-remote-dom.md b/documentation/migrations/remote-ui-to-remote-dom.md index e59bf4cd..64b30453 100644 --- a/documentation/migrations/remote-ui-to-remote-dom.md +++ b/documentation/migrations/remote-ui-to-remote-dom.md @@ -78,7 +78,9 @@ import {RemoteReceiver} from '@remote-dom/core'; import {retain, release} from '@quilted/threads'; // You now need to pass in functions to manage the memory for functions manually, -// where this was previously done automatically in `@remote-ui/rpc`. +// where this was previously done automatically in `@remote-ui/rpc`. If you are +// using the automatic memory management provided by `@quilted/threads`, you can +// omit the `retain` and `release` functions. const receiver = new RemoteReceiver({retain, release}); sendToRemoteEnvironment(receiver.connection); ``` diff --git a/examples/custom-element/app/index.html b/examples/custom-element/app/index.html index b0db8ec7..3e3d25bb 100644 --- a/examples/custom-element/app/index.html +++ b/examples/custom-element/app/index.html @@ -88,7 +88,7 @@ diff --git a/examples/custom-element/app/remote.html b/examples/custom-element/app/remote.html index 1bf28e38..e6858d55 100644 --- a/examples/custom-element/app/remote.html +++ b/examples/custom-element/app/remote.html @@ -57,7 +57,7 @@