Remote, browser, view and execution context


#1

I am struggling with understanding how atom is build. Could somebody validate I got it right?

I understand that chrome is divided into browser and renderers which communicate via ipc. I am guessing that scripts in atom/src/browser are executed in browser and those in atom/src are executed in renderers. This is why

"require 'browser-window'" would fail in my test package. 

I found code which works:

"BrowserWindow = require('remote').require 'browser-window'"

And I explain it as follow: the “remote” object gives me link from renderer into the main process, which is capable in its turn to create new browser window. Am I correct in my interpretation?

And what is “< webview >”? Is it an iframe? And this is why it does work in my package, because renderer is allowed to inject elements into its own document?


#2

I think your interpretation is correct. As for webview, there’s some documentation available in the electron repo.

Here’s the excerpt about the differences between webview and iframe:

Different from the iframe, the webview runs in a separate process than your app; it doesn’t have the same permissions as your web page and all interactions between your app and embedded content will be asynchronous. This keeps your app safe from the embedded content.


#3

There is an old topic here:

Where I explain how, at least at the time, Atom started up with references to the code to illustrate how everything fit together. I haven’t worked with Electron for a while though, so it make have changed in the interim.

I hope it helps!


#4

The confusing names of browser and client have been changed. There is a thread about it on atom/atom but I don’t have time to find it at the moment.


#5

Ah ha. Only now I understood relations between Atom and Electron . I thought that Electron is yet another package for Atom whereas in fact, Atom is an application which uses Electron platform. This relation was not obvious after I red Atom documentation.