'While developing, my website will reload upon code changes'
'Is there a solution that avoids "re-pairing" my Puck.js on every page load'
Although I haven't tried this, what about using the Html < iframe >element?
Embed the page that will reload as the iFrame itself, retaining the PuckJs code called from the outer container. In that way, when the inner iframe page is reloaded, the outer calling page doesn't perform the Puck re-initialization.
Using an iframe could work for dev page reload, I think it may be possible to even achieve reconnect across a tab/window reload (getDevices() will return an already paired device), but I will keep this workaround in mind, thanks!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thr 2021.04.29
Although I haven't tried this, what about using the Html
< iframe >
element?Embed the page that will reload as the iFrame itself, retaining the PuckJs code called from the outer container. In that way, when the inner iframe page is reloaded, the outer calling page doesn't perform the Puck re-initialization.
or possibly using the
onload()
event, set a variable within the page Global scope that bypasses the Html section that loads the PuckJs code.