top | item 41439181

(no title)

benshumaker0 | 1 year ago

Thanks for the notes! I'll look into spline.

I've never of a web app that lets you pull panels to a second screen. Sounds neat though. Is there a good reference?

discuss

order

jitl|1 year ago

You can use window.open to create a child window whose DOM is writable by the main thread of the parent window. You can then mount a React root in the child and go off to the races.

This issue with this strategy is usually over reliance on 3rd party code that assumes that globalThis.window is the only window, and event handlers don’t end up working or something.

If you are using good libraries that really understand the DOM (React itself handles this well) or you write things yourself, it’s a bit of bother to add “target window” as a parameter to various functions that were previously using the global but quite doable.

I built an electron app that has one “root” window that is hidden that I use to spawn child windows without needing to load an entire new web page & instance of the JS bundle into each window. I used Tldraw and had to do some patch-package to fix global window assumptions in a few places.

Here’s my code: https://github.com/justjake/tlshot/blob/main/src/renderer/ed...