You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.
First, there's very BIG different between electron in structure, and docs is not update-to-date, you must find in the source code for a while.
since lots of <webview> method is missing in muon, we must retrieve webContents ID and pass to remote.getWebContents function to get webContents
the way to retrieve webContents ID from <webview> is add event listener on undocumented event did-attach or guest-ready, the tabId key is our webContents ID.
but, remote.getWebContents is not identical to electron's, here's the signature:
remote.getWebContents(tabId, callback)
tabId Integer - webContents ID
callback Function
webContents Object
if we need to openDevTools at <webview> startup, it should be:
constwebview=document.getElementById('foo')webview.addEventListener('did-attach',event=>{// remote is located in chrome objectchrome.remote.getWebContents(event.tabId,webContents=>{webContents.openDevTools()})})
I would not recommend using any of the remote apis. We are removing them as quickly as we can remove their usage from Brave. See https://github.com/brave/browser-laptop/blob/master/app/browser/tabs.js#L707 for an example of doing this in the browser process instead of the renderer process. The example is for background pages, but the same thing will work for normal pages
I follow the exmaple in doc like:
and
but it throw a error:
Uncaught TypeError: webview.openDevTools is not a function
Am I missing something? or it just didn't be supported anymore?
The text was updated successfully, but these errors were encountered: