diff --git a/README.md b/README.md index 295bf17..1b6a6df 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,9 @@ A basic Electron application needs just these files: - `package.json` - Points to the app's main file and lists its details and dependencies. - `main.js` - Starts the app and creates a browser window to render HTML. This is the app's **main process**. - `index.html` - A web page to render. This is the app's **renderer process**. +- `preload.js` - A content script that runs before the renderer process loads. -You can learn more about each of these components within the [Quick Start Guide](https://electronjs.org/docs/latest/tutorial/quick-start). +You can learn more about each of these components in depth within the [Tutorial](https://electronjs.org/docs/latest/tutorial/tutorial-1-prerequisites). ## To Use @@ -32,8 +33,7 @@ Note: If you're using Linux Bash for Windows, [see this guide](https://www.howto ## Resources for Learning Electron - [electronjs.org/docs](https://electronjs.org/docs) - all of Electron's documentation -- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - a very basic starter Electron app -- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - small demo apps for the various Electron APIs +- [Electron Fiddle](https://electronjs.org/fiddle) - Electron Fiddle, an app to test small Electron experiments ## License diff --git a/preload.js b/preload.js index c2ff9c1..3610a37 100644 --- a/preload.js +++ b/preload.js @@ -1,5 +1,10 @@ -// All of the Node.js APIs are available in the preload process. -// It has the same sandbox as a Chrome extension. +/** + * The preload script runs before. It has access to web APIs + * as well as Electron's renderer process modules and some + * polyfilled Node.js functions. + * + * https://www.electronjs.org/docs/latest/tutorial/sandbox + */ window.addEventListener('DOMContentLoaded', () => { const replaceText = (selector, text) => { const element = document.getElementById(selector) diff --git a/renderer.js b/renderer.js index d3bdade..1e70849 100644 --- a/renderer.js +++ b/renderer.js @@ -1,6 +1,7 @@ -// This file is required by the index.html file and will -// be executed in the renderer process for that window. -// No Node.js APIs are available in this process because -// `nodeIntegration` is turned off. Use `preload.js` to -// selectively enable features needed in the rendering -// process. +/** + * This file is loaded via the