chore: update links in comments (#37197)
This commit is contained in:
parent
3180312595
commit
a37f572388
9 changed files with 45 additions and 45 deletions
|
@ -6,7 +6,7 @@
|
||||||
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
||||||
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
||||||
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
||||||
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
|
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
|
||||||
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
|
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
|
||||||
# if you pass a custom value for 'target_cpu'.
|
# if you pass a custom value for 'target_cpu'.
|
||||||
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
||||||
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
||||||
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
||||||
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
|
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
|
||||||
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
|
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
|
||||||
# if you pass a custom value for 'target_cpu'.
|
# if you pass a custom value for 'target_cpu'.
|
||||||
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
is_electron_build = true
|
is_electron_build = true
|
||||||
root_extra_deps = [ "//electron" ]
|
root_extra_deps = [ "//electron" ]
|
||||||
|
|
||||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
|
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
|
||||||
node_module_version = 114
|
node_module_version = 114
|
||||||
|
|
||||||
v8_promise_internal_field_count = 1
|
v8_promise_internal_field_count = 1
|
||||||
|
|
|
@ -61,7 +61,7 @@ class MessagePort : public gin::Wrappable<MessagePort>, mojo::MessageReceiver {
|
||||||
// The blink version of MessagePort uses the very nice "ActiveScriptWrapper"
|
// The blink version of MessagePort uses the very nice "ActiveScriptWrapper"
|
||||||
// class, which keeps the object alive through the V8 embedder hooks into the
|
// class, which keeps the object alive through the V8 embedder hooks into the
|
||||||
// GC lifecycle: see
|
// GC lifecycle: see
|
||||||
// https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/heap/thread_state.cc;l=258;drc=b892cf58e162a8f66cd76d7472f129fe0fb6a7d1
|
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/heap/thread_state.cc;l=258;drc=b892cf58e162a8f66cd76d7472f129fe0fb6a7d1
|
||||||
// We do not have that luxury, so we brutishly use v8::Global to accomplish
|
// We do not have that luxury, so we brutishly use v8::Global to accomplish
|
||||||
// something similar. Critically, whenever the value of
|
// something similar. Critically, whenever the value of
|
||||||
// "HasPendingActivity()" changes, we must call Pin() or Unpin() as
|
// "HasPendingActivity()" changes, we must call Pin() or Unpin() as
|
||||||
|
|
|
@ -561,7 +561,7 @@ void ElectronBrowserMainParts::PostCreateMainMessageLoop() {
|
||||||
config->main_thread_runner =
|
config->main_thread_runner =
|
||||||
base::SingleThreadTaskRunner::GetCurrentDefault();
|
base::SingleThreadTaskRunner::GetCurrentDefault();
|
||||||
// c.f.
|
// c.f.
|
||||||
// https://source.chromium.org/chromium/chromium/src/+/master:chrome/common/chrome_switches.cc;l=689;drc=9d82515060b9b75fa941986f5db7390299669ef1
|
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_switches.cc;l=689;drc=9d82515060b9b75fa941986f5db7390299669ef1
|
||||||
config->should_use_preference =
|
config->should_use_preference =
|
||||||
command_line.HasSwitch(::switches::kEnableEncryptionSelection);
|
command_line.HasSwitch(::switches::kEnableEncryptionSelection);
|
||||||
base::PathService::Get(DIR_SESSION_DATA, &config->user_data_path);
|
base::PathService::Get(DIR_SESSION_DATA, &config->user_data_path);
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ content::DesktopMediaID NativeWindowMac::GetDesktopMediaID() const {
|
||||||
auto desktop_media_id = content::DesktopMediaID(
|
auto desktop_media_id = content::DesktopMediaID(
|
||||||
content::DesktopMediaID::TYPE_WINDOW, GetAcceleratedWidget());
|
content::DesktopMediaID::TYPE_WINDOW, GetAcceleratedWidget());
|
||||||
// c.f.
|
// c.f.
|
||||||
// https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/media/webrtc/native_desktop_media_list.cc;l=372?q=kWindowCaptureMacV2&ss=chromium
|
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/media/webrtc/native_desktop_media_list.cc;l=775-780;drc=79502ab47f61bff351426f57f576daef02b1a8dc
|
||||||
// Refs https://github.com/electron/electron/pull/30507
|
// Refs https://github.com/electron/electron/pull/30507
|
||||||
// TODO(deepak1556): Match upstream for `kWindowCaptureMacV2`
|
// TODO(deepak1556): Match upstream for `kWindowCaptureMacV2`
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "ui/gtk/gtk_compat.h" // nogncheck
|
#include "ui/gtk/gtk_compat.h" // nogncheck
|
||||||
|
|
||||||
// The following utilities are pulled from
|
// The following utilities are pulled from
|
||||||
// https://source.chromium.org/chromium/chromium/src/+/main:ui/gtk/select_file_dialog_impl_gtk.cc;l=43-74
|
// https://source.chromium.org/chromium/chromium/src/+/main:ui/gtk/select_file_dialog_linux_gtk.cc;l=44-75;drc=a03ba4ca94f75531207c3ea832d6a605cde77394
|
||||||
namespace gtk_util {
|
namespace gtk_util {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -30,7 +30,7 @@ import {
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
// Quick start
|
// Quick start
|
||||||
// https://github.com/electron/electron/blob/master/docs/tutorial/quick-start.md
|
// https://github.com/electron/electron/blob/main/docs/tutorial/quick-start.md
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the javascript object is GCed.
|
// be closed automatically when the javascript object is GCed.
|
||||||
|
@ -318,7 +318,7 @@ app.setAboutPanelOptions({
|
||||||
})
|
})
|
||||||
|
|
||||||
// Online/Offline Event Detection
|
// Online/Offline Event Detection
|
||||||
// https://github.com/electron/electron/blob/master/docs/tutorial/online-offline-events.md
|
// https://github.com/electron/electron/blob/main/docs/tutorial/online-offline-events.md
|
||||||
|
|
||||||
let onlineStatusWindow: Electron.BrowserWindow
|
let onlineStatusWindow: Electron.BrowserWindow
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ ipcMain.on('online-status-changed', (event: any, status: any) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Synopsis
|
// Synopsis
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/synopsis.md
|
// https://github.com/electron/electron/blob/main/docs/api/synopsis.md
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
window = new BrowserWindow({
|
window = new BrowserWindow({
|
||||||
|
@ -345,14 +345,14 @@ app.whenReady().then(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Supported command line switches
|
// Supported command line switches
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/command-line-switches.md
|
// https://github.com/electron/electron/blob/main/docs/api/command-line-switches.md
|
||||||
|
|
||||||
app.commandLine.appendSwitch('remote-debugging-port', '8315')
|
app.commandLine.appendSwitch('remote-debugging-port', '8315')
|
||||||
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')
|
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')
|
||||||
app.commandLine.appendSwitch('vmodule', 'console=0')
|
app.commandLine.appendSwitch('vmodule', 'console=0')
|
||||||
|
|
||||||
// systemPreferences
|
// systemPreferences
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/system-preferences.md
|
// https://github.com/electron/electron/blob/main/docs/api/system-preferences.md
|
||||||
|
|
||||||
const browserOptions = {
|
const browserOptions = {
|
||||||
width: 1000,
|
width: 1000,
|
||||||
|
@ -391,7 +391,7 @@ if (browserOptions.transparent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// app
|
// app
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/app.md
|
// https://github.com/electron/electron/blob/main/docs/api/app.md
|
||||||
|
|
||||||
app.on('certificate-error', function (event, webContents, url, error, certificate, callback) {
|
app.on('certificate-error', function (event, webContents, url, error, certificate, callback) {
|
||||||
if (url === 'https://github.com') {
|
if (url === 'https://github.com') {
|
||||||
|
@ -422,7 +422,7 @@ app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) })
|
||||||
app.exit(0)
|
app.exit(0)
|
||||||
|
|
||||||
// auto-updater
|
// auto-updater
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/auto-updater.md
|
// https://github.com/electron/electron/blob/main/docs/api/auto-updater.md
|
||||||
|
|
||||||
autoUpdater.setFeedURL({
|
autoUpdater.setFeedURL({
|
||||||
url: 'http://mycompany.com/myapp/latest?version=' + app.getVersion(),
|
url: 'http://mycompany.com/myapp/latest?version=' + app.getVersion(),
|
||||||
|
@ -443,7 +443,7 @@ autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName, releaseDa
|
||||||
})
|
})
|
||||||
|
|
||||||
// BrowserWindow
|
// BrowserWindow
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/browser-window.md
|
// https://github.com/electron/electron/blob/main/docs/api/browser-window.md
|
||||||
|
|
||||||
let win3 = new BrowserWindow({ width: 800, height: 600, show: false })
|
let win3 = new BrowserWindow({ width: 800, height: 600, show: false })
|
||||||
win3.on('closed', () => {
|
win3.on('closed', () => {
|
||||||
|
@ -469,7 +469,7 @@ window.setVibrancy('popover')
|
||||||
window.setIcon('/path/to/icon')
|
window.setIcon('/path/to/icon')
|
||||||
|
|
||||||
// content-tracing
|
// content-tracing
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/content-tracing.md
|
// https://github.com/electron/electron/blob/main/docs/api/content-tracing.md
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
categoryFilter: '*',
|
categoryFilter: '*',
|
||||||
|
@ -486,7 +486,7 @@ contentTracing.startRecording(options).then(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// dialog
|
// dialog
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/dialog.md
|
// https://github.com/electron/electron/blob/main/docs/api/dialog.md
|
||||||
|
|
||||||
// variant without browserWindow
|
// variant without browserWindow
|
||||||
dialog.showOpenDialogSync({
|
dialog.showOpenDialogSync({
|
||||||
|
@ -507,7 +507,7 @@ dialog.showOpenDialog(win3, {
|
||||||
})
|
})
|
||||||
|
|
||||||
// global-shortcut
|
// global-shortcut
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/global-shortcut.md
|
// https://github.com/electron/electron/blob/main/docs/api/global-shortcut.md
|
||||||
|
|
||||||
// Register a 'ctrl+x' shortcut listener.
|
// Register a 'ctrl+x' shortcut listener.
|
||||||
const ret = globalShortcut.register('ctrl+x', () => {
|
const ret = globalShortcut.register('ctrl+x', () => {
|
||||||
|
@ -525,7 +525,7 @@ globalShortcut.unregister('ctrl+x')
|
||||||
globalShortcut.unregisterAll()
|
globalShortcut.unregisterAll()
|
||||||
|
|
||||||
// ipcMain
|
// ipcMain
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/ipc-main-process.md
|
// https://github.com/electron/electron/blob/main/docs/api/ipc-main.md
|
||||||
|
|
||||||
ipcMain.on('asynchronous-message', (event, arg: any) => {
|
ipcMain.on('asynchronous-message', (event, arg: any) => {
|
||||||
console.log(arg) // prints "ping"
|
console.log(arg) // prints "ping"
|
||||||
|
@ -551,7 +551,7 @@ const winWindows = new BrowserWindow({
|
||||||
})
|
})
|
||||||
|
|
||||||
// menu-item
|
// menu-item
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/menu-item.md
|
// https://github.com/electron/electron/blob/main/docs/api/menu-item.md
|
||||||
|
|
||||||
const menuItem = new MenuItem({})
|
const menuItem = new MenuItem({})
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ menuItem.click = (passedMenuItem: Electron.MenuItem, browserWindow: Electron.Bro
|
||||||
}
|
}
|
||||||
|
|
||||||
// menu
|
// menu
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/menu.md
|
// https://github.com/electron/electron/blob/main/docs/api/menu.md
|
||||||
|
|
||||||
let menu = new Menu()
|
let menu = new Menu()
|
||||||
menu.append(new MenuItem({ label: 'MenuItem1', click: () => { console.log('item 1 clicked') } }))
|
menu.append(new MenuItem({ label: 'MenuItem1', click: () => { console.log('item 1 clicked') } }))
|
||||||
|
@ -809,7 +809,7 @@ Menu.buildFromTemplate([
|
||||||
])
|
])
|
||||||
|
|
||||||
// net
|
// net
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/net.md
|
// https://github.com/electron/electron/blob/main/docs/api/net.md
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
const request = net.request('https://github.com')
|
const request = net.request('https://github.com')
|
||||||
|
@ -854,7 +854,7 @@ app.whenReady().then(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// power-monitor
|
// power-monitor
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/power-monitor.md
|
// https://github.com/electron/electron/blob/main/docs/api/power-monitor.md
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
powerMonitor.on('suspend', () => {
|
powerMonitor.on('suspend', () => {
|
||||||
|
@ -872,7 +872,7 @@ app.whenReady().then(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// power-save-blocker
|
// power-save-blocker
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/power-save-blocker.md
|
// https://github.com/electron/electron/blob/main/docs/api/power-save-blocker.md
|
||||||
|
|
||||||
const id = powerSaveBlocker.start('prevent-display-sleep')
|
const id = powerSaveBlocker.start('prevent-display-sleep')
|
||||||
console.log(powerSaveBlocker.isStarted(id))
|
console.log(powerSaveBlocker.isStarted(id))
|
||||||
|
@ -880,7 +880,7 @@ console.log(powerSaveBlocker.isStarted(id))
|
||||||
powerSaveBlocker.stop(id)
|
powerSaveBlocker.stop(id)
|
||||||
|
|
||||||
// protocol
|
// protocol
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/protocol.md
|
// https://github.com/electron/electron/blob/main/docs/api/protocol.md
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
protocol.registerSchemesAsPrivileged([{ scheme: 'https', privileges: { standard: true, allowServiceWorkers: true } }])
|
protocol.registerSchemesAsPrivileged([{ scheme: 'https', privileges: { standard: true, allowServiceWorkers: true } }])
|
||||||
|
@ -907,7 +907,7 @@ app.whenReady().then(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// tray
|
// tray
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/tray.md
|
// https://github.com/electron/electron/blob/main/docs/api/tray.md
|
||||||
|
|
||||||
let appIcon: Electron.Tray = null
|
let appIcon: Electron.Tray = null
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
|
@ -950,7 +950,7 @@ app.whenReady().then(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// clipboard
|
// clipboard
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/clipboard.md
|
// https://github.com/electron/electron/blob/main/docs/api/clipboard.md
|
||||||
|
|
||||||
{
|
{
|
||||||
let str: string
|
let str: string
|
||||||
|
@ -973,7 +973,7 @@ app.whenReady().then(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// crash-reporter
|
// crash-reporter
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/crash-reporter.md
|
// https://github.com/electron/electron/blob/main/docs/api/crash-reporter.md
|
||||||
|
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
productName: 'YourName',
|
productName: 'YourName',
|
||||||
|
@ -989,7 +989,7 @@ console.log(crashReporter.getLastCrashReport())
|
||||||
console.log(crashReporter.getUploadedReports())
|
console.log(crashReporter.getUploadedReports())
|
||||||
|
|
||||||
// nativeImage
|
// nativeImage
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/native-image.md
|
// https://github.com/electron/electron/blob/main/docs/api/native-image.md
|
||||||
|
|
||||||
const appIcon2 = new Tray('/Users/somebody/images/icon.png')
|
const appIcon2 = new Tray('/Users/somebody/images/icon.png')
|
||||||
const window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' })
|
const window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' })
|
||||||
|
@ -1000,7 +1000,7 @@ const appIcon4 = new Tray('/Users/somebody/images/icon.png')
|
||||||
const image2 = nativeImage.createFromPath('/Users/somebody/images/icon.png')
|
const image2 = nativeImage.createFromPath('/Users/somebody/images/icon.png')
|
||||||
|
|
||||||
// process
|
// process
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/process.md
|
// https://github.com/electron/electron/blob/main/docs/api/process.md
|
||||||
|
|
||||||
console.log(process.versions.electron)
|
console.log(process.versions.electron)
|
||||||
console.log(process.versions.chrome)
|
console.log(process.versions.chrome)
|
||||||
|
@ -1014,7 +1014,7 @@ process.hang()
|
||||||
process.setFdLimit(8192)
|
process.setFdLimit(8192)
|
||||||
|
|
||||||
// screen
|
// screen
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/screen.md
|
// https://github.com/electron/electron/blob/main/docs/api/screen.md
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
const size = screen.getPrimaryDisplay().workAreaSize
|
const size = screen.getPrimaryDisplay().workAreaSize
|
||||||
|
@ -1052,7 +1052,7 @@ app.whenReady().then(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// shell
|
// shell
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/shell.md
|
// https://github.com/electron/electron/blob/main/docs/api/shell.md
|
||||||
|
|
||||||
shell.showItemInFolder('/home/user/Desktop/test.txt')
|
shell.showItemInFolder('/home/user/Desktop/test.txt')
|
||||||
shell.trashItem('/home/user/Desktop/test.txt').then(() => {})
|
shell.trashItem('/home/user/Desktop/test.txt').then(() => {})
|
||||||
|
@ -1070,7 +1070,7 @@ shell.beep()
|
||||||
shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readShortcutLink('/home/user/Desktop/shortcut.lnk'))
|
shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readShortcutLink('/home/user/Desktop/shortcut.lnk'))
|
||||||
|
|
||||||
// cookies
|
// cookies
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/cookies.md
|
// https://github.com/electron/electron/blob/main/docs/api/cookies.md
|
||||||
{
|
{
|
||||||
// Query all cookies.
|
// Query all cookies.
|
||||||
session.defaultSession.cookies.get({})
|
session.defaultSession.cookies.get({})
|
||||||
|
@ -1100,7 +1100,7 @@ shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readS
|
||||||
}
|
}
|
||||||
|
|
||||||
// session
|
// session
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/session.md
|
// https://github.com/electron/electron/blob/main/docs/api/session.md
|
||||||
|
|
||||||
session.defaultSession.on('will-download', (event, item, webContents) => {
|
session.defaultSession.on('will-download', (event, item, webContents) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -1197,7 +1197,7 @@ app.whenReady().then(function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
// webContents
|
// webContents
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/web-contents.md
|
// https://github.com/electron/electron/blob/main/docs/api/web-contents.md
|
||||||
|
|
||||||
console.log(webContents.getAllWebContents())
|
console.log(webContents.getAllWebContents())
|
||||||
console.log(webContents.getFocusedWebContents())
|
console.log(webContents.getFocusedWebContents())
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
|
||||||
// In renderer process (web page).
|
// In renderer process (web page).
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/ipc-renderer.md
|
// https://github.com/electron/electron/blob/main/docs/api/ipc-renderer.md
|
||||||
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"
|
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"
|
||||||
|
|
||||||
ipcRenderer.on('asynchronous-reply', (event, arg: any) => {
|
ipcRenderer.on('asynchronous-reply', (event, arg: any) => {
|
||||||
|
@ -22,7 +22,7 @@ ipcRenderer.on('asynchronous-reply', (event, arg: any) => {
|
||||||
ipcRenderer.send('asynchronous-message', 'ping')
|
ipcRenderer.send('asynchronous-message', 'ping')
|
||||||
|
|
||||||
// web-frame
|
// web-frame
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/web-frame.md
|
// https://github.com/electron/electron/blob/main/docs/api/web-frame.md
|
||||||
|
|
||||||
webFrame.setZoomFactor(2)
|
webFrame.setZoomFactor(2)
|
||||||
console.log(webFrame.getZoomFactor())
|
console.log(webFrame.getZoomFactor())
|
||||||
|
@ -53,7 +53,7 @@ console.log(webFrame.getResourceUsage())
|
||||||
webFrame.clearCache()
|
webFrame.clearCache()
|
||||||
|
|
||||||
// clipboard
|
// clipboard
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/clipboard.md
|
// https://github.com/electron/electron/blob/main/docs/api/clipboard.md
|
||||||
|
|
||||||
clipboard.writeText('Example String')
|
clipboard.writeText('Example String')
|
||||||
clipboard.writeText('Example String', 'selection')
|
clipboard.writeText('Example String', 'selection')
|
||||||
|
@ -69,7 +69,7 @@ clipboard.write({
|
||||||
})
|
})
|
||||||
|
|
||||||
// crash-reporter
|
// crash-reporter
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/crash-reporter.md
|
// https://github.com/electron/electron/blob/main/docs/api/crash-reporter.md
|
||||||
|
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
productName: 'YourName',
|
productName: 'YourName',
|
||||||
|
@ -79,7 +79,7 @@ crashReporter.start({
|
||||||
})
|
})
|
||||||
|
|
||||||
// desktopCapturer
|
// desktopCapturer
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/desktop-capturer.md
|
// https://github.com/electron/electron/blob/main/docs/api/desktop-capturer.md
|
||||||
|
|
||||||
desktopCapturer.getSources({ types: ['window', 'screen'] }).then(sources => {
|
desktopCapturer.getSources({ types: ['window', 'screen'] }).then(sources => {
|
||||||
for (let i = 0; i < sources.length; ++i) {
|
for (let i = 0; i < sources.length; ++i) {
|
||||||
|
@ -111,7 +111,7 @@ function getUserMediaError (error: Error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// File object
|
// File object
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/file-object.md
|
// https://github.com/electron/electron/blob/main/docs/api/file-object.md
|
||||||
|
|
||||||
/*
|
/*
|
||||||
<div id="holder">
|
<div id="holder">
|
||||||
|
@ -137,11 +137,11 @@ holder.ondrop = function (e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nativeImage
|
// nativeImage
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/native-image.md
|
// https://github.com/electron/electron/blob/main/docs/api/native-image.md
|
||||||
|
|
||||||
const image = clipboard.readImage()
|
const image = clipboard.readImage()
|
||||||
|
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/process.md
|
// https://github.com/electron/electron/blob/main/docs/api/process.md
|
||||||
|
|
||||||
// preload.js
|
// preload.js
|
||||||
const _setImmediate = setImmediate
|
const _setImmediate = setImmediate
|
||||||
|
@ -152,12 +152,12 @@ process.once('loaded', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
// shell
|
// shell
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/shell.md
|
// https://github.com/electron/electron/blob/main/docs/api/shell.md
|
||||||
|
|
||||||
shell.openExternal('https://github.com').then(() => {})
|
shell.openExternal('https://github.com').then(() => {})
|
||||||
|
|
||||||
// <webview>
|
// <webview>
|
||||||
// https://github.com/electron/electron/blob/master/docs/api/web-view-tag.md
|
// https://github.com/electron/electron/blob/main/docs/api/webview-tag.md
|
||||||
|
|
||||||
const webview = document.createElement('webview')
|
const webview = document.createElement('webview')
|
||||||
webview.loadURL('https://github.com')
|
webview.loadURL('https://github.com')
|
||||||
|
|
Loading…
Reference in a new issue