The mounting process is quite complex but really clever. I didn't know this way of iframe communication. However, this is working only on same domain. By the way, I just want to know if you have planned a refactoring to use a postMessage communication or something similar that allow to communicate between different domains ?
Thanks.
This line do nothing. It can be removed.
https://github.com/nuxt/devtools/blob/f3c3de1d95ba5da08dd665c2918500b309adb2af/packages/devtools/src/runtime/plugins/view/client.ts#L270
syncClient
tell the iframe to set the client at https://github.com/nuxt/devtools/blob/f3c3de1d95ba5da08dd665c2918500b309adb2af/packages/devtools/src/runtime/plugins/view/client.ts#L116 But at this point of the mounting process, the iframe isn't even present in the DOM. The iframe will be appended to the body and mounted just after.This
syncClient
function will be called by thegetIframe()
function here : https://github.com/nuxt/devtools/blob/f3c3de1d95ba5da08dd665c2918500b309adb2af/packages/devtools/src/runtime/plugins/view/client.ts#L124 Or by theopen()
function. Note that this function trigger twicesyncClient
. You can put aconsole.trace(client, iframe)
line 112 to see that.Removing this line 270 has no impact.
The mounting process is quite complex but really clever. I didn't know this way of iframe communication. However, this is working only on same domain. By the way, I just want to know if you have planned a refactoring to use a
postMessage
communication or something similar that allow to communicate between different domains ? Thanks.