asticode / astilectron

Electron app that provides an API over a TCP socket that allows executing Electron's method as well as capturing Electron's events

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Forwarding Electron BrowserWindow to js code

EugeneBiazrukov opened this issue · comments

Hi astielectron!
I am currently using Astielectron in an asti+react code. I am using electron webview tag inside js part of the application. According to Electron Docs webview tag is not preferred to use because of its instability. I would like to migrate from webview tag to Electron's BrowserView. Unfortunately, to manipulate with BrowserView I need to attach it to Electron BrowserWindow instance. Is it possible to somehow to forward BrowserWindow instance to js API of astilectron?

Each created window has a unique id attached to it so my guess is that would be possible.

However, I don't understand fully your use case for using BrowserView instead of a simple BrowserWindow. Can you share a little bit of code that would explain it ?

Thank you for your response, it was very helpful.
Unfortunately, I am not able to share code snippets, but I can share main concepts: I have the third-party authorizations that are embedded inside the window by tag. I would like to replace this tag with Electron's BrowserView

When you say third-party authorizations you mean something like OAuth authorizations?

If so, why not create a different window for each third-party authorization instead of a different webview ?