mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
132 Commits
sam/claude
...
v37.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc05e5f40e | ||
|
|
65c062d3f9 | ||
|
|
fc55862138 | ||
|
|
2856008e52 | ||
|
|
abba008673 | ||
|
|
bbf8003f0f | ||
|
|
9aedb9c1f4 | ||
|
|
47e927ac2b | ||
|
|
e73d57cc08 | ||
|
|
99a224e45b | ||
|
|
1754c55c05 | ||
|
|
1eb8f7e705 | ||
|
|
e45eab5b35 | ||
|
|
75cda9e16b | ||
|
|
be53277b54 | ||
|
|
253d49b24f | ||
|
|
42325294ab | ||
|
|
285bbc560b | ||
|
|
713030b21a | ||
|
|
9e453030ae | ||
|
|
d4e22c97b2 | ||
|
|
6ce5f88940 | ||
|
|
cfa2efe0c2 | ||
|
|
221f5ee3d6 | ||
|
|
2f1dfc73ac | ||
|
|
3ea4c6c3e7 | ||
|
|
5bd18aac95 | ||
|
|
03c32ba3be | ||
|
|
bef6e11b9d | ||
|
|
f72ec2c45a | ||
|
|
ba6f0358b0 | ||
|
|
2f4472f058 | ||
|
|
32599dda44 | ||
|
|
d2c95a28bb | ||
|
|
e90404be7d | ||
|
|
b494ae62ba | ||
|
|
5953dca8be | ||
|
|
9f4b16fa81 | ||
|
|
a6569b116e | ||
|
|
dd0fb7d24d | ||
|
|
d657036a1b | ||
|
|
b875976f04 | ||
|
|
f1f7bd631f | ||
|
|
08e27c02ea | ||
|
|
8275e86f0a | ||
|
|
3fdb77abf1 | ||
|
|
2e2d1f1612 | ||
|
|
c68389ad98 | ||
|
|
380351c01b | ||
|
|
c382d4c875 | ||
|
|
2fb2cc030d | ||
|
|
1d8e9e1d52 | ||
|
|
bdcf09861e | ||
|
|
cd1afd6d9a | ||
|
|
ca22facaaf | ||
|
|
95212a539b | ||
|
|
91c153ed0b | ||
|
|
ab78c8a295 | ||
|
|
c2e8d71683 | ||
|
|
47e0baf21d | ||
|
|
f9b86609a9 | ||
|
|
7dd024a9dc | ||
|
|
65b9accc80 | ||
|
|
584fa31adc | ||
|
|
c0149676fb | ||
|
|
b39305af61 | ||
|
|
6e7271ff7e | ||
|
|
3e07a0e9a3 | ||
|
|
6a16fc3144 | ||
|
|
e53a7c7c00 | ||
|
|
63052c45a1 | ||
|
|
28c5f7026f | ||
|
|
c78be76176 | ||
|
|
73dd132202 | ||
|
|
f6e7cdb8b6 | ||
|
|
54f2c93fec | ||
|
|
ecc00f149f | ||
|
|
791235b15b | ||
|
|
692d648edb | ||
|
|
bbb6aabe41 | ||
|
|
cc302c2f07 | ||
|
|
b6779056f2 | ||
|
|
d7990ca180 | ||
|
|
7cb5a46b66 | ||
|
|
917e95433a | ||
|
|
7db9671420 | ||
|
|
a3d19d7a99 | ||
|
|
f1562543a3 | ||
|
|
bf54b8d709 | ||
|
|
ec83c1303c | ||
|
|
ec1b0f4923 | ||
|
|
be5b02386d | ||
|
|
df8ed0acc3 | ||
|
|
8de0bb5bc3 | ||
|
|
25c7f0017a | ||
|
|
546d9f4ba6 | ||
|
|
434f77e6c1 | ||
|
|
ace7ef4316 | ||
|
|
0e9c0d8c04 | ||
|
|
8f37d42241 | ||
|
|
3d836267ed | ||
|
|
440cdec061 | ||
|
|
4eea6e4974 | ||
|
|
2c6f713d72 | ||
|
|
057437f739 | ||
|
|
b59a7ef2c3 | ||
|
|
069c9a9e1f | ||
|
|
5602efb2b6 | ||
|
|
839590eb90 | ||
|
|
c9d1615b19 | ||
|
|
4597f4ba9e | ||
|
|
2cf774b2b8 | ||
|
|
3029cdb4dd | ||
|
|
6bd6180703 | ||
|
|
cd023b54f5 | ||
|
|
7dfa2b92fb | ||
|
|
8189b01987 | ||
|
|
0c683552ec | ||
|
|
018e2f6a31 | ||
|
|
3c8d971c53 | ||
|
|
258762929f | ||
|
|
01994637e8 | ||
|
|
0810fe54d4 | ||
|
|
d783f134d9 | ||
|
|
bf94f88569 | ||
|
|
47e25dfd57 | ||
|
|
03d83c293f | ||
|
|
46e3ab6353 | ||
|
|
620f3a57dd | ||
|
|
534ad05cf2 | ||
|
|
7c77018b19 | ||
|
|
6696b98ecc |
6
.github/actions/build-electron/action.yml
vendored
6
.github/actions/build-electron/action.yml
vendored
@@ -38,6 +38,9 @@ runs:
|
||||
run: |
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"x64\" v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
|
||||
- name: Build Electron ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -199,6 +202,9 @@ runs:
|
||||
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
- name: Remove Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::remove-matcher owner=clang::"
|
||||
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.is-release == 'true' }}
|
||||
shell: bash
|
||||
|
||||
83
.github/actions/build-git-cache/action.yml
vendored
Normal file
83
.github/actions/build-git-cache/action.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
name: 'Build Git Cache'
|
||||
description: 'Runs a gclient sync to build the git cache for Electron'
|
||||
inputs:
|
||||
target-platform:
|
||||
description: 'Target platform, should be linux, win, macos'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set GIT_CACHE_PATH to make gclient to use the cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
|
||||
- name: Set Chromium Git Cookie
|
||||
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Set up cache drive
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
echo "CACHE_DRIVE=/mnt/win-cache" >> $GITHUB_ENV
|
||||
else
|
||||
echo "CACHE_DRIVE=/mnt/cross-instance-cache" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Check cross instance cache disk space
|
||||
shell: bash
|
||||
run: |
|
||||
# if there is less than 35 GB free space then creating the cache might fail so exit early
|
||||
freespace=`df -m $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
|
||||
freespace_human=`df -h $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
|
||||
if [ $freespace -le 35000 ]; then
|
||||
echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
|
||||
exit 1
|
||||
else
|
||||
echo "The cross mount cache has $freespace_human free space - continuing"
|
||||
fi
|
||||
- name: Restore gitcache
|
||||
shell: bash
|
||||
run: |
|
||||
GIT_CACHE_TAR="$CACHE_DRIVE/gitcache.tar"
|
||||
if [ ! -f "$GIT_CACHE_TAR" ]; then
|
||||
echo "Git cache tar file does not exist, skipping restore"
|
||||
exit 0
|
||||
fi
|
||||
echo "Restoring git cache from $GIT_CACHE_TAR to $GIT_CACHE_PATH"
|
||||
mkdir -p $GIT_CACHE_PATH
|
||||
tar -xf $GIT_CACHE_TAR -C $GIT_CACHE_PATH
|
||||
- name: Gclient Sync
|
||||
shell: bash
|
||||
run: |
|
||||
e d gclient config \
|
||||
--name "src/electron" \
|
||||
--unmanaged \
|
||||
${GCLIENT_EXTRA_ARGS} \
|
||||
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
|
||||
|
||||
if [ "$TARGET_OS" != "" ]; then
|
||||
echo "target_os=['$TARGET_OS']" >> ./.gclient
|
||||
fi
|
||||
|
||||
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags --nohooks -vv
|
||||
- name: Compress Git Cache Directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Uncompressed gitcache size: $(du -sh $GIT_CACHE_PATH | cut -f1 -d' ')"
|
||||
cd $GIT_CACHE_PATH
|
||||
tar -cf ../gitcache.tar .
|
||||
cd ..
|
||||
echo "Compressed gitcache to $(du -sh gitcache.tar | cut -f1 -d' ')"
|
||||
# remove the old cache file if it exists
|
||||
if [ -f $CACHE_DRIVE/gitcache.tar ]; then
|
||||
echo "Removing old gitcache.tar from $CACHE_DRIVE"
|
||||
rm $CACHE_DRIVE/gitcache.tar
|
||||
fi
|
||||
cp ./gitcache.tar $CACHE_DRIVE/
|
||||
- name: Wait for active SSH sessions
|
||||
shell: bash
|
||||
if: always() && !cancelled()
|
||||
run: |
|
||||
while [ -f /var/.ssh-lock ]
|
||||
do
|
||||
sleep 60
|
||||
done
|
||||
35
.github/actions/checkout/action.yml
vendored
35
.github/actions/checkout/action.yml
vendored
@@ -43,7 +43,7 @@ runs:
|
||||
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}" > sas-token
|
||||
- name: Save SAS Key
|
||||
if: ${{ inputs.generate-sas-token == 'true' }}
|
||||
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
with:
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
@@ -80,6 +80,21 @@ runs:
|
||||
else
|
||||
echo "The cross mount cache has $freespace_human free space - continuing"
|
||||
fi
|
||||
- name: Add patch conflict problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/patch-conflict.json"
|
||||
- name: Restore gitcache
|
||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||
shell: bash
|
||||
run: |
|
||||
GIT_CACHE_TAR="$CACHE_DRIVE/gitcache.tar"
|
||||
if [ ! -f "$GIT_CACHE_TAR" ]; then
|
||||
echo "Git cache tar file does not exist, skipping restore"
|
||||
exit 0
|
||||
fi
|
||||
echo "Restoring git cache from $GIT_CACHE_TAR to $GIT_CACHE_PATH"
|
||||
mkdir -p $GIT_CACHE_PATH
|
||||
tar -xf $GIT_CACHE_TAR -C $GIT_CACHE_PATH
|
||||
- name: Gclient Sync
|
||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||
shell: bash
|
||||
@@ -102,12 +117,7 @@ runs:
|
||||
git update-index --refresh || true
|
||||
if ! git diff-index --quiet HEAD --; then
|
||||
# There are changes to the patches. Make a git commit with the updated patches
|
||||
git add patches
|
||||
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
|
||||
# Export it
|
||||
mkdir -p ../../patches
|
||||
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
|
||||
if node ./script/push-patch.js; then
|
||||
if node ./script/patch-up.js; then
|
||||
echo
|
||||
echo "======================================================================"
|
||||
echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
|
||||
@@ -115,6 +125,11 @@ runs:
|
||||
echo "======================================================================"
|
||||
exit 1
|
||||
else
|
||||
git add patches
|
||||
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
|
||||
# Export it
|
||||
mkdir -p ../../patches
|
||||
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
|
||||
echo
|
||||
echo "======================================================================"
|
||||
echo "There were changes to the patches when applying."
|
||||
@@ -128,7 +143,11 @@ runs:
|
||||
echo "No changes to patches detected"
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Remove patch conflict problem matcher
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::remove-matcher owner=merge-conflict::"
|
||||
echo "::remove-matcher owner=patch-conflict::"
|
||||
# delete all .git directories under src/ except for
|
||||
# third_party/angle/ and third_party/dawn/ because of build time generation of files
|
||||
# gen/angle/commit.h depends on third_party/angle/.git/HEAD
|
||||
|
||||
13
.github/actions/install-build-tools/action.yml
vendored
13
.github/actions/install-build-tools/action.yml
vendored
@@ -13,13 +13,18 @@ runs:
|
||||
git config --global core.fscache true
|
||||
git config --global core.preloadindex true
|
||||
fi
|
||||
export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
|
||||
export BUILD_TOOLS_SHA=f2a960b4d82e6b5c9dbbd437378a39489f399c50
|
||||
npm i -g @electron/build-tools
|
||||
# Update depot_tools to ensure python
|
||||
e d update_depot_tools
|
||||
e auto-update disable
|
||||
# Disable further updates of depot_tools
|
||||
e d auto-update disable
|
||||
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
|
||||
e d cipd.bat --version
|
||||
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
|
||||
fi
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
|
||||
echo "C:\Users\ContainerAdministrator\.electron_build_tools\third_party\depot_tools" >> $GITHUB_PATH
|
||||
else
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
|
||||
fi
|
||||
@@ -7,7 +7,7 @@ runs:
|
||||
shell: bash
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(node src/electron/script/yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
@@ -8,14 +8,14 @@ runs:
|
||||
steps:
|
||||
- name: Obtain SAS Key
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
with:
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-1
|
||||
enableCrossOsArchive: true
|
||||
- name: Obtain SAS Key
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
with:
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
@@ -32,7 +32,7 @@ runs:
|
||||
shell: bash
|
||||
command: |
|
||||
sas_token=$(cat sas-token)
|
||||
if [ -z $sas-token ]; then
|
||||
if [ -z "$sas_token" ]; then
|
||||
echo "SAS Token not found; exiting src cache download early..."
|
||||
exit 1
|
||||
else
|
||||
|
||||
18
.github/problem-matchers/clang.json
vendored
Normal file
18
.github/problem-matchers/clang.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "clang",
|
||||
"fromPath": "src/out/Default/args.gn",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(.+)[(:](\\d+)[:,](\\d+)\\)?:\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
22
.github/problem-matchers/eslint-stylish.json
vendored
Normal file
22
.github/problem-matchers/eslint-stylish.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "eslint-stylish",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\s*([^\\s].*)$",
|
||||
"file": 1
|
||||
},
|
||||
{
|
||||
"regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$",
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"severity": 3,
|
||||
"message": 4,
|
||||
"code": 5,
|
||||
"loop": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
24
.github/problem-matchers/patch-conflict.json
vendored
Normal file
24
.github/problem-matchers/patch-conflict.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "merge-conflict",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^CONFLICT\\s\\(\\S+\\): (Merge conflict in \\S+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "patch-conflict",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^error: (patch failed: (\\S+):(\\d+))$",
|
||||
"message": 1,
|
||||
"file": 2,
|
||||
"line": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
2
.github/workflows/archaeologist-dig.yml
vendored
2
.github/workflows/archaeologist-dig.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Setup Node.js/npm
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
- name: Setting Up Dig Site
|
||||
run: |
|
||||
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
|
||||
|
||||
74
.github/workflows/build-git-cache.yml
vendored
Normal file
74
.github/workflows/build-git-cache.yml
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
name: Build Git Cache
|
||||
# This workflow updates git cache on the cross-instance cache volumes
|
||||
# It runs daily at midnight.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
build-git-cache-linux:
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Build Git Cache
|
||||
uses: ./src/electron/.github/actions/build-git-cache
|
||||
with:
|
||||
target-platform: linux
|
||||
|
||||
build-git-cache-windows:
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
volumes:
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
|
||||
TARGET_OS: 'win'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Build Git Cache
|
||||
uses: ./src/electron/.github/actions/build-git-cache
|
||||
with:
|
||||
target-platform: win
|
||||
|
||||
build-git-cache-macos:
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
# This job updates the same git cache as linux, so it needs to run after the linux one.
|
||||
needs: build-git-cache-linux
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Build Git Cache
|
||||
uses: ./src/electron/.github/actions/build-git-cache
|
||||
with:
|
||||
target-platform: macos
|
||||
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -128,7 +128,7 @@ jobs:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /var/run/sas:/var/run/sas
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
|
||||
outputs:
|
||||
|
||||
3
.github/workflows/pipeline-electron-lint.yml
vendored
3
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -61,6 +61,9 @@ jobs:
|
||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||
|
||||
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
|
||||
- name: Add ESLint problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/eslint-stylish.json"
|
||||
- name: Run Lint
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
cache: yarn
|
||||
cache-dependency-path: src/electron/yarn.lock
|
||||
- name: Install Dependencies
|
||||
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
- name: Add TCC permissions on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: |
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"config": {
|
||||
"extends": "@electron/lint-roller/configs/markdownlint.json",
|
||||
"descriptive-link-text": false,
|
||||
"link-image-style": {
|
||||
"autolink": false,
|
||||
"shortcut": false
|
||||
@@ -26,6 +27,6 @@
|
||||
"no-newline-in-links": true
|
||||
},
|
||||
"customRules": [
|
||||
"@electron/lint-roller/markdownlint-rules/"
|
||||
"./node_modules/@electron/lint-roller/markdownlint-rules/index.mjs"
|
||||
]
|
||||
}
|
||||
|
||||
2
BUILD.gn
2
BUILD.gn
@@ -670,6 +670,8 @@ source_set("electron_lib") {
|
||||
sources += [
|
||||
"shell/browser/certificate_manager_model.cc",
|
||||
"shell/browser/certificate_manager_model.h",
|
||||
"shell/browser/linux/x11_util.cc",
|
||||
"shell/browser/linux/x11_util.h",
|
||||
"shell/browser/ui/gtk_util.cc",
|
||||
"shell/browser/ui/gtk_util.h",
|
||||
]
|
||||
|
||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'137.0.7151.0',
|
||||
'138.0.7204.97',
|
||||
'node_version':
|
||||
'v22.14.0',
|
||||
'v22.17.0',
|
||||
'nan_version':
|
||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||
'squirrel.mac_version':
|
||||
|
||||
14
README.md
14
README.md
@@ -44,29 +44,17 @@ Each Electron release provides binaries for macOS, Windows, and Linux.
|
||||
* Fedora 32 and newer
|
||||
* Debian 10 and newer
|
||||
|
||||
## Quick start & Electron Fiddle
|
||||
## Electron Fiddle
|
||||
|
||||
Use [`Electron Fiddle`](https://github.com/electron/fiddle)
|
||||
to build, run, and package small Electron experiments, to see code examples for all of Electron's APIs, and
|
||||
to try out different versions of Electron. It's designed to make the start of your journey with
|
||||
Electron easier.
|
||||
|
||||
Alternatively, clone and run the
|
||||
[electron/electron-quick-start](https://github.com/electron/electron-quick-start)
|
||||
repository to see a minimal Electron app in action:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/electron/electron-quick-start
|
||||
cd electron-quick-start
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## Resources for learning Electron
|
||||
|
||||
* [electronjs.org/docs](https://electronjs.org/docs) - All of Electron's documentation
|
||||
* [electron/fiddle](https://github.com/electron/fiddle) - A tool to build, run, and package small Electron experiments
|
||||
* [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - A very basic starter Electron app
|
||||
* [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - Sample starter apps created by the community
|
||||
|
||||
## Programmatic usage
|
||||
|
||||
@@ -113,6 +113,7 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [dialog](api/dialog.md)
|
||||
* [globalShortcut](api/global-shortcut.md)
|
||||
* [inAppPurchase](api/in-app-purchase.md)
|
||||
* [ImageView](api/image-view.md)
|
||||
* [ipcMain](api/ipc-main.md)
|
||||
* [Menu](api/menu.md)
|
||||
* [MenuItem](api/menu-item.md)
|
||||
|
||||
167
docs/api/app.md
167
docs/api/app.md
@@ -41,9 +41,10 @@ that was used to open the application, if it was launched from Notification Cent
|
||||
You can also call `app.isReady()` to check if this event has already fired and `app.whenReady()`
|
||||
to get a Promise that is fulfilled when Electron is initialized.
|
||||
|
||||
**Note**: The `ready` event is only fired after the main process has finished running the first
|
||||
tick of the event loop. If an Electron API needs to be called before the `ready` event, ensure
|
||||
that it is called synchronously in the top-level context of the main process.
|
||||
> [!NOTE]
|
||||
> The `ready` event is only fired after the main process has finished running the first
|
||||
> tick of the event loop. If an Electron API needs to be called before the `ready` event, ensure
|
||||
> that it is called synchronously in the top-level context of the main process.
|
||||
|
||||
### Event: 'window-all-closed'
|
||||
|
||||
@@ -66,12 +67,14 @@ Emitted before the application starts closing its windows.
|
||||
Calling `event.preventDefault()` will prevent the default behavior, which is
|
||||
terminating the application.
|
||||
|
||||
**Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
|
||||
then `before-quit` is emitted _after_ emitting `close` event on all windows and
|
||||
closing them.
|
||||
> [!NOTE]
|
||||
> If application quit was initiated by `autoUpdater.quitAndInstall()`,
|
||||
> then `before-quit` is emitted _after_ emitting `close` event on all windows and
|
||||
> closing them.
|
||||
|
||||
**Note:** On Windows, this event will not be emitted if the app is closed due
|
||||
to a shutdown/restart of the system or a user logout.
|
||||
> [!NOTE]
|
||||
> On Windows, this event will not be emitted if the app is closed due
|
||||
> to a shutdown/restart of the system or a user logout.
|
||||
|
||||
### Event: 'will-quit'
|
||||
|
||||
@@ -86,8 +89,9 @@ terminating the application.
|
||||
See the description of the `window-all-closed` event for the differences between
|
||||
the `will-quit` and `window-all-closed` events.
|
||||
|
||||
**Note:** On Windows, this event will not be emitted if the app is closed due
|
||||
to a shutdown/restart of the system or a user logout.
|
||||
> [!NOTE]
|
||||
> On Windows, this event will not be emitted if the app is closed due
|
||||
> to a shutdown/restart of the system or a user logout.
|
||||
|
||||
### Event: 'quit'
|
||||
|
||||
@@ -98,8 +102,9 @@ Returns:
|
||||
|
||||
Emitted when the application is quitting.
|
||||
|
||||
**Note:** On Windows, this event will not be emitted if the app is closed due
|
||||
to a shutdown/restart of the system or a user logout.
|
||||
> [!NOTE]
|
||||
> On Windows, this event will not be emitted if the app is closed due
|
||||
> to a shutdown/restart of the system or a user logout.
|
||||
|
||||
### Event: 'open-file' _macOS_
|
||||
|
||||
@@ -470,24 +475,28 @@ and `workingDirectory` is its current working directory. Usually
|
||||
applications respond to this by making their primary window focused and
|
||||
non-minimized.
|
||||
|
||||
**Note:** `argv` will not be exactly the same list of arguments as those passed
|
||||
to the second instance. The order might change and additional arguments might be appended.
|
||||
If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
|
||||
> [!NOTE]
|
||||
> `argv` will not be exactly the same list of arguments as those passed
|
||||
> to the second instance. The order might change and additional arguments might be appended.
|
||||
> If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
|
||||
|
||||
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
||||
> [!NOTE]
|
||||
> If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
||||
|
||||
This event is guaranteed to be emitted after the `ready` event of `app`
|
||||
gets emitted.
|
||||
|
||||
**Note:** Extra command line arguments might be added by Chromium,
|
||||
such as `--original-process-start-time`.
|
||||
> [!NOTE]
|
||||
> Extra command line arguments might be added by Chromium,
|
||||
> such as `--original-process-start-time`.
|
||||
|
||||
## Methods
|
||||
|
||||
The `app` object has the following methods:
|
||||
|
||||
**Note:** Some methods are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some methods are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
### `app.quit()`
|
||||
|
||||
@@ -679,7 +688,8 @@ preferred over `name` by Electron.
|
||||
|
||||
Overrides the current application's name.
|
||||
|
||||
**Note:** This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
|
||||
> [!NOTE]
|
||||
> This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
|
||||
|
||||
### `app.getLocale()`
|
||||
|
||||
@@ -688,18 +698,22 @@ Possible return values are documented [here](https://source.chromium.org/chromiu
|
||||
|
||||
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](command-line-switches.md).
|
||||
|
||||
**Note:** When distributing your packaged app, you have to also ship the
|
||||
`locales` folder.
|
||||
> [!NOTE]
|
||||
> When distributing your packaged app, you have to also ship the
|
||||
> `locales` folder.
|
||||
|
||||
**Note:** This API must be called after the `ready` event is emitted.
|
||||
> [!NOTE]
|
||||
> This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||
> [!NOTE]
|
||||
> To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||
|
||||
### `app.getLocaleCountryCode()`
|
||||
|
||||
Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
|
||||
|
||||
**Note:** When unable to detect locale country code, it returns empty string.
|
||||
> [!NOTE]
|
||||
> When unable to detect locale country code, it returns empty string.
|
||||
|
||||
### `app.getSystemLocale()`
|
||||
|
||||
@@ -712,9 +726,11 @@ Different operating systems also use the regional data differently:
|
||||
|
||||
Therefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS.
|
||||
|
||||
**Note:** This API must be called after the `ready` event is emitted.
|
||||
> [!NOTE]
|
||||
> This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||
> [!NOTE]
|
||||
> To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||
|
||||
### `app.getPreferredSystemLanguages()`
|
||||
|
||||
@@ -777,16 +793,18 @@ Once registered, all links with `your-protocol://` will be opened with the
|
||||
current executable. The whole link, including protocol, will be passed to your
|
||||
application as a parameter.
|
||||
|
||||
**Note:** On macOS, you can only register protocols that have been added to
|
||||
your app's `info.plist`, which cannot be modified at runtime. However, you can
|
||||
change the file during build time via [Electron Forge][electron-forge],
|
||||
[Electron Packager][electron-packager], or by editing `info.plist` with a text
|
||||
editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
|
||||
> [!NOTE]
|
||||
> On macOS, you can only register protocols that have been added to
|
||||
> your app's `info.plist`, which cannot be modified at runtime. However, you can
|
||||
> change the file during build time via [Electron Forge][electron-forge],
|
||||
> [Electron Packager][electron-packager], or by editing `info.plist` with a text
|
||||
> editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
|
||||
|
||||
**Note:** In a Windows Store environment (when packaged as an `appx`) this API
|
||||
will return `true` for all calls but the registry key it sets won't be accessible
|
||||
by other applications. In order to register your Windows Store application
|
||||
as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
|
||||
> [!NOTE]
|
||||
> In a Windows Store environment (when packaged as an `appx`) this API
|
||||
> will return `true` for all calls but the registry key it sets won't be accessible
|
||||
> by other applications. In order to register your Windows Store application
|
||||
> as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
|
||||
|
||||
The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.
|
||||
|
||||
@@ -810,11 +828,12 @@ protocol (aka URI scheme). If so, it will remove the app as the default handler.
|
||||
Returns `boolean` - Whether the current executable is the default handler for a
|
||||
protocol (aka URI scheme).
|
||||
|
||||
**Note:** On macOS, you can use this method to check if the app has been
|
||||
registered as the default protocol handler for a protocol. You can also verify
|
||||
this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
|
||||
macOS machine. Please refer to
|
||||
[Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
|
||||
> [!NOTE]
|
||||
> On macOS, you can use this method to check if the app has been
|
||||
> registered as the default protocol handler for a protocol. You can also verify
|
||||
> this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
|
||||
> macOS machine. Please refer to
|
||||
> [Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
|
||||
|
||||
The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally.
|
||||
|
||||
@@ -858,8 +877,9 @@ Adds `tasks` to the [Tasks][tasks] category of the Jump List on Windows.
|
||||
|
||||
Returns `boolean` - Whether the call succeeded.
|
||||
|
||||
**Note:** If you'd like to customize the Jump List even more use
|
||||
`app.setJumpList(categories)` instead.
|
||||
> [!NOTE]
|
||||
> If you'd like to customize the Jump List even more use
|
||||
> `app.setJumpList(categories)` instead.
|
||||
|
||||
### `app.getJumpListSettings()` _Windows_
|
||||
|
||||
@@ -897,21 +917,24 @@ following strings:
|
||||
If `categories` is `null` the previously set custom Jump List (if any) will be
|
||||
replaced by the standard Jump List for the app (managed by Windows).
|
||||
|
||||
**Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
|
||||
property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
> [!NOTE]
|
||||
> If a `JumpListCategory` object has neither the `type` nor the `name`
|
||||
> property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
is set but the `type` property is omitted then the `type` is assumed to be
|
||||
`custom`.
|
||||
|
||||
**Note:** Users can remove items from custom categories, and Windows will not
|
||||
allow a removed item to be added back into a custom category until **after**
|
||||
the next successful call to `app.setJumpList(categories)`. Any attempt to
|
||||
re-add a removed item to a custom category earlier than that will result in the
|
||||
entire custom category being omitted from the Jump List. The list of removed
|
||||
items can be obtained using `app.getJumpListSettings()`.
|
||||
> [!NOTE]
|
||||
> Users can remove items from custom categories, and Windows will not
|
||||
> allow a removed item to be added back into a custom category until **after**
|
||||
> the next successful call to `app.setJumpList(categories)`. Any attempt to
|
||||
> re-add a removed item to a custom category earlier than that will result in the
|
||||
> entire custom category being omitted from the Jump List. The list of removed
|
||||
> items can be obtained using `app.getJumpListSettings()`.
|
||||
|
||||
**Note:** The maximum length of a Jump List item's `description` property is
|
||||
260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
List, nor will it be displayed.
|
||||
> [!NOTE]
|
||||
> The maximum length of a Jump List item's `description` property is
|
||||
> 260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
> List, nor will it be displayed.
|
||||
|
||||
Here's a very simple example of creating a custom Jump List:
|
||||
|
||||
@@ -1188,7 +1211,8 @@ Returns [`ProcessMetric[]`](structures/process-metric.md): Array of `ProcessMetr
|
||||
|
||||
Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Feature Status from `chrome://gpu/`.
|
||||
|
||||
**Note:** This information is only usable after the `gpu-info-update` event is emitted.
|
||||
> [!NOTE]
|
||||
> This information is only usable after the `gpu-info-update` event is emitted.
|
||||
|
||||
### `app.getGPUInfo(infoType)`
|
||||
|
||||
@@ -1242,11 +1266,13 @@ badge.
|
||||
|
||||
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
|
||||
|
||||
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
|
||||
please read the [Unity integration documentation][unity-requirement].
|
||||
> [!NOTE]
|
||||
> Unity launcher requires a `.desktop` file to work. For more information,
|
||||
> please read the [Unity integration documentation][unity-requirement].
|
||||
|
||||
**Note:** On macOS, you need to ensure that your application has the permission
|
||||
to display notifications for this method to work.
|
||||
> [!NOTE]
|
||||
> On macOS, you need to ensure that your application has the permission
|
||||
> to display notifications for this method to work.
|
||||
|
||||
### `app.getBadgeCount()` _Linux_ _macOS_
|
||||
|
||||
@@ -1348,7 +1374,8 @@ details. Disabled by default.
|
||||
|
||||
This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||
> [!NOTE]
|
||||
> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||
|
||||
### `app.showAboutPanel()`
|
||||
|
||||
@@ -1476,7 +1503,8 @@ By using this API, important information such as password and other sensitive in
|
||||
See [Apple's documentation](https://developer.apple.com/library/archive/technotes/tn2150/_index.html) for more
|
||||
details.
|
||||
|
||||
**Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
|
||||
> [!NOTE]
|
||||
> Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
|
||||
|
||||
### `app.setProxy(config)`
|
||||
|
||||
@@ -1490,7 +1518,7 @@ and internal requests made by the runtime (ex: geolocation queries).
|
||||
|
||||
This method can only be called after app is ready.
|
||||
|
||||
#### `app.resolveProxy(url)`
|
||||
### `app.resolveProxy(url)`
|
||||
|
||||
* `url` URL
|
||||
|
||||
@@ -1538,7 +1566,8 @@ See [Chromium's accessibility docs](https://www.chromium.org/developers/design-d
|
||||
|
||||
This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||
> [!NOTE]
|
||||
> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||
|
||||
### `app.applicationMenu`
|
||||
|
||||
@@ -1551,11 +1580,13 @@ An `Integer` property that returns the badge count for current app. Setting the
|
||||
|
||||
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
|
||||
|
||||
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
|
||||
please read the [Unity integration documentation][unity-requirement].
|
||||
> [!NOTE]
|
||||
> Unity launcher requires a `.desktop` file to work. For more information,
|
||||
> please read the [Unity integration documentation][unity-requirement].
|
||||
|
||||
**Note:** On macOS, you need to ensure that your application has the permission
|
||||
to display notifications for this property to take effect.
|
||||
> [!NOTE]
|
||||
> On macOS, you need to ensure that your application has the permission
|
||||
> to display notifications for this property to take effect.
|
||||
|
||||
### `app.commandLine` _Readonly_
|
||||
|
||||
|
||||
@@ -26,8 +26,9 @@ requirements, you can read [Server Support][server-support]. Note that
|
||||
update process. Apps that need to disable ATS can add the
|
||||
`NSAllowsArbitraryLoads` key to their app's plist.
|
||||
|
||||
**Note:** Your application must be signed for automatic updates on macOS.
|
||||
This is a requirement of `Squirrel.Mac`.
|
||||
> [!IMPORTANT]
|
||||
> Your application must be signed for automatic updates on macOS.
|
||||
> This is a requirement of `Squirrel.Mac`.
|
||||
|
||||
### Windows
|
||||
|
||||
@@ -93,8 +94,9 @@ Emitted when an update has been downloaded.
|
||||
|
||||
On Windows only `releaseName` is available.
|
||||
|
||||
**Note:** It is not strictly necessary to handle this event. A successfully
|
||||
downloaded update will still be applied the next time the application starts.
|
||||
> [!NOTE]
|
||||
> It is not strictly necessary to handle this event. A successfully
|
||||
> downloaded update will still be applied the next time the application starts.
|
||||
|
||||
### Event: 'before-quit-for-update'
|
||||
|
||||
@@ -125,8 +127,9 @@ Returns `string` - The current update feed URL.
|
||||
Asks the server whether there is an update. You must call `setFeedURL` before
|
||||
using this API.
|
||||
|
||||
**Note:** If an update is available it will be downloaded automatically.
|
||||
Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
|
||||
> [!NOTE]
|
||||
> If an update is available it will be downloaded automatically.
|
||||
> Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
|
||||
|
||||
### `autoUpdater.quitAndInstall()`
|
||||
|
||||
@@ -137,9 +140,10 @@ Under the hood calling `autoUpdater.quitAndInstall()` will close all application
|
||||
windows first, and automatically call `app.quit()` after all windows have been
|
||||
closed.
|
||||
|
||||
**Note:** It is not strictly necessary to call this function to apply an update,
|
||||
as a successfully downloaded update will always be applied the next time the
|
||||
application starts.
|
||||
> [!NOTE]
|
||||
> It is not strictly necessary to call this function to apply an update,
|
||||
> as a successfully downloaded update will always be applied the next time the
|
||||
> application starts.
|
||||
|
||||
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
|
||||
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> `BaseWindow` provides a flexible way to compose multiple web views in a
|
||||
> single window. For windows with only a single, full-size web view, the
|
||||
> [`BrowserWindow`](browser-window.md) class may be a simpler option.
|
||||
@@ -99,6 +99,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
It creates a new `BaseWindow` with native properties as set by the `options`.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new BaseWindow([options])`
|
||||
|
||||
* `options` [BaseWindowConstructorOptions](structures/base-window-options.md?inline) (optional)
|
||||
@@ -107,8 +111,9 @@ It creates a new `BaseWindow` with native properties as set by the `options`.
|
||||
|
||||
Objects created with `new BaseWindow` emit the following events:
|
||||
|
||||
**Note:** Some events are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some events are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
#### Event: 'close'
|
||||
|
||||
@@ -137,7 +142,11 @@ window.onbeforeunload = (e) => {
|
||||
}
|
||||
```
|
||||
|
||||
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
|
||||
> [!NOTE]
|
||||
> There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and
|
||||
> `window.addEventListener('beforeunload', handler)`. It is recommended to always set the
|
||||
> `event.returnValue` explicitly, instead of only returning a value, as the former works more
|
||||
> consistently within Electron.
|
||||
|
||||
#### Event: 'closed'
|
||||
|
||||
@@ -252,7 +261,8 @@ Emitted when the window is being moved to a new position.
|
||||
|
||||
Emitted once when the window is moved to a new position.
|
||||
|
||||
**Note**: On macOS this event is an alias of `move`.
|
||||
> [!NOTE]
|
||||
> On macOS, this event is an alias of `move`.
|
||||
|
||||
#### Event: 'enter-full-screen'
|
||||
|
||||
@@ -356,7 +366,7 @@ as `-webkit-app-region: drag` in a frameless window.
|
||||
|
||||
Calling `event.preventDefault()` will prevent the menu from being displayed.
|
||||
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows).
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
|
||||
|
||||
### Static Methods
|
||||
|
||||
@@ -421,7 +431,8 @@ A `boolean` property that determines whether the window is focusable.
|
||||
|
||||
A `boolean` property that determines whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** Always returns false on Windows.
|
||||
> [!NOTE]
|
||||
> Always returns false on Windows.
|
||||
|
||||
#### `win.shadow`
|
||||
|
||||
@@ -431,7 +442,8 @@ A `boolean` property that determines whether the window has a shadow.
|
||||
|
||||
A `boolean` property that determines whether the menu bar should be visible.
|
||||
|
||||
**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
> [!NOTE]
|
||||
> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.kiosk`
|
||||
|
||||
@@ -452,7 +464,8 @@ and the icon of the file will show in window's title bar.
|
||||
|
||||
A `string` property that determines the title of the native window.
|
||||
|
||||
**Note:** The title of the web page can be different from the title of the native window.
|
||||
> [!NOTE]
|
||||
> The title of the web page can be different from the title of the native window.
|
||||
|
||||
#### `win.minimizable` _macOS_ _Windows_
|
||||
|
||||
@@ -521,8 +534,9 @@ A `boolean` property that indicates whether the window is arranged via [Snap.](h
|
||||
|
||||
Objects created with `new BaseWindow` have the following instance methods:
|
||||
|
||||
**Note:** Some methods are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some methods are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
#### `win.setContentView(view)`
|
||||
|
||||
@@ -614,7 +628,8 @@ Returns `boolean` - Whether the window is minimized.
|
||||
|
||||
Sets whether the window should be in fullscreen mode.
|
||||
|
||||
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
|
||||
> [!NOTE]
|
||||
> On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or > ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
|
||||
|
||||
#### `win.isFullScreen()`
|
||||
|
||||
@@ -728,13 +743,15 @@ win.setBounds({ width: 100 })
|
||||
console.log(win.getBounds())
|
||||
```
|
||||
|
||||
**Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
> [!NOTE]
|
||||
> On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
|
||||
#### `win.getBounds()`
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
|
||||
|
||||
**Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
> [!NOTE]
|
||||
> On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
|
||||
#### `win.getBackgroundColor()`
|
||||
|
||||
@@ -742,7 +759,8 @@ Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) fo
|
||||
|
||||
See [Setting `backgroundColor`](browser-window.md#setting-the-backgroundcolor-property).
|
||||
|
||||
**Note:** The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
> [!NOTE]
|
||||
> The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
|
||||
#### `win.setContentBounds(bounds[, animate])`
|
||||
|
||||
@@ -760,7 +778,8 @@ Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's cl
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - Contains the window bounds of the normal state
|
||||
|
||||
**Note:** whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
|
||||
> [!NOTE]
|
||||
> Whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
|
||||
|
||||
#### `win.setEnabled(enable)`
|
||||
|
||||
@@ -957,8 +976,9 @@ Changes the title of native window to `title`.
|
||||
|
||||
Returns `string` - The title of the native window.
|
||||
|
||||
**Note:** The title of the web page can be different from the title of the native
|
||||
window.
|
||||
> [!NOTE]
|
||||
> The title of the web page can be different from the title of the native
|
||||
> window.
|
||||
|
||||
#### `win.setSheetOffset(offsetY[, offsetX])` _macOS_
|
||||
|
||||
@@ -1232,8 +1252,9 @@ in the taskbar.
|
||||
|
||||
Sets the properties for the window's taskbar button.
|
||||
|
||||
**Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
|
||||
together. If one of those properties is not set, then neither will be used.
|
||||
> [!NOTE]
|
||||
> `relaunchCommand` and `relaunchDisplayName` must always be set
|
||||
> together. If one of those properties is not set, then neither will be used.
|
||||
|
||||
#### `win.setIcon(icon)` _Windows_ _Linux_
|
||||
|
||||
@@ -1293,13 +1314,15 @@ maximize button, or by dragging it to the edges of the screen.
|
||||
|
||||
Sets whether the window should be visible on all workspaces.
|
||||
|
||||
**Note:** This API does nothing on Windows.
|
||||
> [!NOTE]
|
||||
> This API does nothing on Windows.
|
||||
|
||||
#### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_
|
||||
|
||||
Returns `boolean` - Whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** This API always returns false on Windows.
|
||||
> [!NOTE]
|
||||
> This API always returns false on Windows.
|
||||
|
||||
#### `win.setIgnoreMouseEvents(ignore[, options])`
|
||||
|
||||
@@ -1327,6 +1350,10 @@ On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
|
||||
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
||||
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
||||
|
||||
#### `win.isContentProtected()` _macOS_ _Windows_
|
||||
|
||||
Returns `boolean` - whether or not content protection is currently enabled.
|
||||
|
||||
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
||||
|
||||
* `focusable` boolean
|
||||
@@ -1416,7 +1443,8 @@ This method sets the browser window's system-drawn background material, includin
|
||||
|
||||
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
|
||||
|
||||
**Note:** This method is only supported on Windows 11 22H2 and up.
|
||||
> [!NOTE]
|
||||
> This method is only supported on Windows 11 22H2 and up.
|
||||
|
||||
#### `win.setWindowButtonPosition(position)` _macOS_
|
||||
|
||||
@@ -1438,8 +1466,9 @@ Sets the touchBar layout for the current window. Specifying `null` or
|
||||
`undefined` clears the touch bar. This method only has an effect if the
|
||||
machine has a touch bar.
|
||||
|
||||
**Note:** The TouchBar API is currently experimental and may change or be
|
||||
removed in future Electron releases.
|
||||
> [!NOTE]
|
||||
> The TouchBar API is currently experimental and may change or be
|
||||
> removed in future Electron releases.
|
||||
|
||||
#### `win.setTitleBarOverlay(options)` _Windows_ _Linux_
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ deprecated:
|
||||
```
|
||||
-->
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -29,7 +29,7 @@ deprecated:
|
||||
|
||||
> Create and control views.
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -38,6 +38,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
This module cannot be used until the `ready` event of the `app`
|
||||
module is emitted.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### Example
|
||||
|
||||
```js
|
||||
@@ -176,4 +180,5 @@ Examples of valid `color` values:
|
||||
* Similar to CSS Color Module Level 3 keywords, but case-sensitive.
|
||||
* e.g. `blueviolet` or `red`
|
||||
|
||||
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
|
||||
> [!NOTE]
|
||||
> Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
|
||||
|
||||
@@ -150,6 +150,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new BrowserWindow([options])`
|
||||
|
||||
* `options` [BrowserWindowConstructorOptions](structures/browser-window-options.md?inline) (optional)
|
||||
@@ -158,7 +162,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
|
||||
Objects created with `new BrowserWindow` emit the following events:
|
||||
|
||||
**Note:** Some events are only available on specific operating systems and are
|
||||
> [!NOTE]
|
||||
> Some events are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
|
||||
#### Event: 'page-title-updated'
|
||||
@@ -200,7 +205,11 @@ window.onbeforeunload = (e) => {
|
||||
}
|
||||
```
|
||||
|
||||
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
|
||||
> [!NOTE]
|
||||
> There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and
|
||||
> `window.addEventListener('beforeunload', handler)`. It is recommended to always set the
|
||||
> `event.returnValue` explicitly, instead of only returning a value, as the former works more
|
||||
> consistently within Electron.
|
||||
|
||||
#### Event: 'closed'
|
||||
|
||||
@@ -323,7 +332,8 @@ Emitted when the window is being moved to a new position.
|
||||
|
||||
Emitted once when the window is moved to a new position.
|
||||
|
||||
**Note**: On macOS this event is an alias of `move`.
|
||||
> [!NOTE]
|
||||
> On macOS, this event is an alias of `move`.
|
||||
|
||||
#### Event: 'enter-full-screen'
|
||||
|
||||
@@ -435,7 +445,7 @@ as `-webkit-app-region: drag` in a frameless window.
|
||||
|
||||
Calling `event.preventDefault()` will prevent the menu from being displayed.
|
||||
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows).
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
|
||||
|
||||
### Static Methods
|
||||
|
||||
@@ -460,7 +470,7 @@ or `null` if the contents are not owned by a window.
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md)
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -522,7 +532,8 @@ A `boolean` property that determines whether the window is focusable.
|
||||
|
||||
A `boolean` property that determines whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** Always returns false on Windows.
|
||||
> [!NOTE]
|
||||
> Always returns false on Windows.
|
||||
|
||||
#### `win.shadow`
|
||||
|
||||
@@ -532,7 +543,8 @@ A `boolean` property that determines whether the window has a shadow.
|
||||
|
||||
A `boolean` property that determines whether the menu bar should be visible.
|
||||
|
||||
**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
> [!NOTE]
|
||||
> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.kiosk`
|
||||
|
||||
@@ -553,7 +565,8 @@ and the icon of the file will show in window's title bar.
|
||||
|
||||
A `string` property that determines the title of the native window.
|
||||
|
||||
**Note:** The title of the web page can be different from the title of the native window.
|
||||
> [!NOTE]
|
||||
> The title of the web page can be different from the title of the native window.
|
||||
|
||||
#### `win.minimizable` _macOS_ _Windows_
|
||||
|
||||
@@ -621,8 +634,9 @@ A `boolean` property that indicates whether the window is arranged via [Snap.](h
|
||||
|
||||
Objects created with `new BrowserWindow` have the following instance methods:
|
||||
|
||||
**Note:** Some methods are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some methods are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
#### `win.destroy()`
|
||||
|
||||
@@ -704,13 +718,15 @@ Returns `boolean` - Whether the window is minimized.
|
||||
|
||||
Sets whether the window should be in fullscreen mode.
|
||||
|
||||
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events.
|
||||
> [!NOTE]
|
||||
> On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events.
|
||||
|
||||
#### `win.isFullScreen()`
|
||||
|
||||
Returns `boolean` - Whether the window is in fullscreen mode.
|
||||
|
||||
**Note:** On macOS, fullscreen transitions take place asynchronously. When querying for a BrowserWindow's fullscreen status, you should ensure that either the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events have been emitted.
|
||||
> [!NOTE]
|
||||
> On macOS, fullscreen transitions take place asynchronously. When querying for a BrowserWindow's fullscreen status, you should ensure that either the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events have been emitted.
|
||||
|
||||
#### `win.setSimpleFullScreen(flag)` _macOS_
|
||||
|
||||
@@ -820,13 +836,15 @@ win.setBounds({ width: 100 })
|
||||
console.log(win.getBounds())
|
||||
```
|
||||
|
||||
**Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
> [!NOTE]
|
||||
> On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
|
||||
#### `win.getBounds()`
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
|
||||
|
||||
**Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
> [!NOTE]
|
||||
> On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
|
||||
#### `win.getBackgroundColor()`
|
||||
|
||||
@@ -834,7 +852,8 @@ Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) fo
|
||||
|
||||
See [Setting `backgroundColor`](#setting-the-backgroundcolor-property).
|
||||
|
||||
**Note:** The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
> [!NOTE]
|
||||
> The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
|
||||
#### `win.setContentBounds(bounds[, animate])`
|
||||
|
||||
@@ -852,7 +871,8 @@ Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's cl
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - Contains the window bounds of the normal state
|
||||
|
||||
**Note:** whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
|
||||
> [!NOTE]
|
||||
> Whatever the current state of the window (maximized, minimized or in fullscreen), this function always returns the position and size of the window in normal state. In normal state, `getBounds` and `getNormalBounds` return the same [`Rectangle`](structures/rectangle.md).
|
||||
|
||||
#### `win.setEnabled(enable)`
|
||||
|
||||
@@ -1049,8 +1069,9 @@ Changes the title of native window to `title`.
|
||||
|
||||
Returns `string` - The title of the native window.
|
||||
|
||||
**Note:** The title of the web page can be different from the title of the native
|
||||
window.
|
||||
> [!NOTE]
|
||||
> The title of the web page can be different from the title of the native
|
||||
> window.
|
||||
|
||||
#### `win.setSheetOffset(offsetY[, offsetX])` _macOS_
|
||||
|
||||
@@ -1409,8 +1430,9 @@ in the taskbar.
|
||||
|
||||
Sets the properties for the window's taskbar button.
|
||||
|
||||
**Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
|
||||
together. If one of those properties is not set, then neither will be used.
|
||||
> [!NOTE]
|
||||
> `relaunchCommand` and `relaunchDisplayName` must always be set
|
||||
> together. If one of those properties is not set, then neither will be used.
|
||||
|
||||
#### `win.showDefinitionForSelection()` _macOS_
|
||||
|
||||
@@ -1474,13 +1496,15 @@ maximize button, or by dragging it to the edges of the screen.
|
||||
|
||||
Sets whether the window should be visible on all workspaces.
|
||||
|
||||
**Note:** This API does nothing on Windows.
|
||||
> [!NOTE]
|
||||
> This API does nothing on Windows.
|
||||
|
||||
#### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_
|
||||
|
||||
Returns `boolean` - Whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** This API always returns false on Windows.
|
||||
> [!NOTE]
|
||||
> This API always returns false on Windows.
|
||||
|
||||
#### `win.setIgnoreMouseEvents(ignore[, options])`
|
||||
|
||||
@@ -1508,6 +1532,10 @@ On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
|
||||
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
||||
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
||||
|
||||
#### `win.isContentProtected()` _macOS_ _Windows_
|
||||
|
||||
Returns `boolean` - whether or not content protection is currently enabled.
|
||||
|
||||
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
||||
|
||||
* `focusable` boolean
|
||||
@@ -1601,7 +1629,8 @@ This method sets the browser window's system-drawn background material, includin
|
||||
|
||||
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
|
||||
|
||||
**Note:** This method is only supported on Windows 11 22H2 and up.
|
||||
> [!NOTE]
|
||||
> This method is only supported on Windows 11 22H2 and up.
|
||||
|
||||
#### `win.setWindowButtonPosition(position)` _macOS_
|
||||
|
||||
@@ -1623,8 +1652,9 @@ Sets the touchBar layout for the current window. Specifying `null` or
|
||||
`undefined` clears the touch bar. This method only has an effect if the
|
||||
machine has a touch bar.
|
||||
|
||||
**Note:** The TouchBar API is currently experimental and may change or be
|
||||
removed in future Electron releases.
|
||||
> [!NOTE]
|
||||
> The TouchBar API is currently experimental and may change or be
|
||||
> removed in future Electron releases.
|
||||
|
||||
#### `win.setBrowserView(browserView)` _Experimental_ _Deprecated_
|
||||
|
||||
@@ -1632,7 +1662,7 @@ removed in future Electron releases.
|
||||
If there are other `BrowserView`s attached, they will be removed from
|
||||
this window.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1641,7 +1671,7 @@ this window.
|
||||
Returns `BrowserView | null` - The `BrowserView` attached to `win`. Returns `null`
|
||||
if one is not attached. Throws an error if multiple `BrowserView`s are attached.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1651,7 +1681,7 @@ if one is not attached. Throws an error if multiple `BrowserView`s are attached.
|
||||
|
||||
Replacement API for setBrowserView supporting work with multi browser views.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1659,7 +1689,7 @@ Replacement API for setBrowserView supporting work with multi browser views.
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md)
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1670,7 +1700,7 @@ Replacement API for setBrowserView supporting work with multi browser views.
|
||||
Raises `browserView` above other `BrowserView`s attached to `win`.
|
||||
Throws an error if `browserView` is not attached to `win`.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1679,7 +1709,7 @@ Throws an error if `browserView` is not attached to `win`.
|
||||
Returns `BrowserView[]` - a sorted by z-index array of all BrowserViews that have been attached
|
||||
with `addBrowserView` or `setBrowserView`. The top-most BrowserView is the last element of the array.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@ following properties:
|
||||
`strict-origin-when-cross-origin`.
|
||||
* `cache` string (optional) - can be `default`, `no-store`, `reload`,
|
||||
`no-cache`, `force-cache` or `only-if-cached`.
|
||||
* `priority` string (optional) - can be `throttled`, `idle`, `lowest`,
|
||||
`low`, `medium`, or `highest`. Defaults to `idle`.
|
||||
* `priorityIncremental` boolean (optional) - the incremental loading flag as part
|
||||
of HTTP extensible priorities (RFC 9218). Default is `true`.
|
||||
|
||||
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
|
||||
strictly follow the Node.js model as described in the
|
||||
|
||||
@@ -18,7 +18,8 @@ console.log(clipboard.readText('selection'))
|
||||
|
||||
The `clipboard` module has the following methods:
|
||||
|
||||
**Note:** Experimental APIs are marked as such and could be removed in future.
|
||||
> [!NOTE]
|
||||
> Experimental APIs are marked as such and could be removed in future.
|
||||
|
||||
### `clipboard.readText([type])`
|
||||
|
||||
@@ -141,9 +142,10 @@ bookmark is unavailable. The `title` value will always be empty on Windows.
|
||||
|
||||
Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
|
||||
|
||||
**Note:** Most apps on Windows don't support pasting bookmarks into them so
|
||||
you can use `clipboard.write` to write both a bookmark and fallback text to the
|
||||
clipboard.
|
||||
> [!NOTE]
|
||||
> Most apps on Windows don't support pasting bookmarks into them so
|
||||
> you can use `clipboard.write` to write both a bookmark and fallback text to the
|
||||
> clipboard.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
@@ -73,7 +73,8 @@ Passing `--enable-logging=file` will result in logs being saved to the file
|
||||
specified by `--log-file=...`, or to `electron_debug.log` in the user-data
|
||||
directory if `--log-file` is not specified.
|
||||
|
||||
> **Note:** On Windows, logs from child processes cannot be sent to stderr.
|
||||
> [!NOTE]
|
||||
> On Windows, logs from child processes cannot be sent to stderr.
|
||||
> Logging to a file is the most reliable way to collect logs on Windows.
|
||||
|
||||
See also `--log-file`, `--log-level`, `--v`, and `--vmodule`.
|
||||
@@ -252,9 +253,10 @@ the required version is unavailable. Current default is set to `3`.
|
||||
|
||||
Electron supports some of the [CLI flags][node-cli] supported by Node.js.
|
||||
|
||||
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
|
||||
> [!NOTE]
|
||||
> Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
|
||||
|
||||
### `--inspect-brk\[=\[host:]port]`
|
||||
### `--inspect-brk[=[host:]port]`
|
||||
|
||||
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
|
||||
|
||||
@@ -266,13 +268,13 @@ Activate inspector on `host:port` and break at start of the first internal
|
||||
JavaScript script executed when the inspector is available.
|
||||
Default `host:port` is `127.0.0.1:9229`.
|
||||
|
||||
### `--inspect-port=\[host:]port`
|
||||
### `--inspect-port=[host:]port`
|
||||
|
||||
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
|
||||
|
||||
Aliased to `--debug-port=[host:]port`.
|
||||
|
||||
### `--inspect\[=\[host:]port]`
|
||||
### `--inspect[=[host:]port]`
|
||||
|
||||
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
|
||||
|
||||
@@ -288,6 +290,10 @@ Specify ways of the inspector web socket url exposure.
|
||||
|
||||
By default inspector websocket url is available in stderr and under /json/list endpoint on `http://host:port/json/list`.
|
||||
|
||||
### `--experimental-network-inspection`
|
||||
|
||||
Enable support for devtools network inspector events, for visibility into requests made by the nodejs `http` and `https` modules.
|
||||
|
||||
### `--no-deprecation`
|
||||
|
||||
Silence deprecation warnings.
|
||||
@@ -319,6 +325,10 @@ Set the directory to which all Node.js diagnostic output files are written. Defa
|
||||
|
||||
Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https://nodejs.org/docs/latest/api/v8.html#v8setheapsnapshotnearheaplimitlimit).
|
||||
|
||||
### `--no-experimental-global-navigator`
|
||||
|
||||
Disable exposition of [Navigator API][] on the global scope from Node.js.
|
||||
|
||||
[app]: app.md
|
||||
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||
@@ -327,3 +337,4 @@ Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https:
|
||||
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
|
||||
[ready]: app.md#event-ready
|
||||
[severities]: https://source.chromium.org/chromium/chromium/src/+/main:base/logging.h?q=logging::LogSeverity&ss=chromium
|
||||
[Navigator API]: https://github.com/nodejs/node/blob/main/doc/api/globals.md#navigator
|
||||
|
||||
@@ -25,8 +25,9 @@ document.
|
||||
|
||||
Append a switch (with optional `value`) to Chromium's command line.
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
> [!NOTE]
|
||||
> This will not affect `process.argv`. The intended usage of this function is to
|
||||
> control Chromium's behavior.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
@@ -49,8 +50,9 @@ const { app } = require('electron')
|
||||
app.commandLine.appendArgument('--enable-experimental-web-platform-features')
|
||||
```
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
> [!NOTE]
|
||||
> This will not affect `process.argv`. The intended usage of this function is to
|
||||
> control Chromium's behavior.
|
||||
|
||||
#### `commandLine.hasSwitch(switch)`
|
||||
|
||||
@@ -84,7 +86,8 @@ const portValue = app.commandLine.getSwitchValue('remote-debugging-port')
|
||||
console.log(portValue) // '8315'
|
||||
```
|
||||
|
||||
**Note:** When the switch is not present or has no value, it returns empty string.
|
||||
> [!NOTE]
|
||||
> When the switch is not present or has no value, it returns empty string.
|
||||
|
||||
#### `commandLine.removeSwitch(switch)`
|
||||
|
||||
@@ -102,5 +105,6 @@ app.commandLine.removeSwitch('remote-debugging-port')
|
||||
console.log(app.commandLine.hasSwitch('remote-debugging-port')) // false
|
||||
```
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
> [!NOTE]
|
||||
> This will not affect `process.argv`. The intended usage of this function is to
|
||||
> control Chromium's behavior.
|
||||
|
||||
@@ -7,8 +7,9 @@ Process: [Main](../glossary.md#main-process)
|
||||
This module does not include a web interface. To view recorded traces, use
|
||||
[trace viewer][], available at `chrome://tracing` in Chrome.
|
||||
|
||||
**Note:** You should not use this module until the `ready` event of the app
|
||||
module is emitted.
|
||||
> [!NOTE]
|
||||
> You should not use this module until the `ready` event of the app
|
||||
> module is emitted.
|
||||
|
||||
```js
|
||||
const { app, contentTracing } = require('electron')
|
||||
|
||||
@@ -19,7 +19,8 @@ following projects:
|
||||
* [socorro](https://github.com/mozilla-services/socorro)
|
||||
* [mini-breakpad-server](https://github.com/electron/mini-breakpad-server)
|
||||
|
||||
> **Note:** Electron uses Crashpad, not Breakpad, to collect and upload
|
||||
> [!NOTE]
|
||||
> Electron uses Crashpad, not Breakpad, to collect and upload
|
||||
> crashes, but for the time being, the [upload protocol is the same](https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/overview_design.md#Upload-to-collection-server).
|
||||
|
||||
Or use a 3rd party hosted solution:
|
||||
@@ -84,19 +85,23 @@ before `app.on('ready')`. If the crash reporter is not initialized at the time
|
||||
a renderer process is created, then that renderer process will not be monitored
|
||||
by the crash reporter.
|
||||
|
||||
**Note:** You can test out the crash reporter by generating a crash using
|
||||
`process.crash()`.
|
||||
> [!NOTE]
|
||||
> You can test out the crash reporter by generating a crash using
|
||||
> `process.crash()`.
|
||||
|
||||
**Note:** If you need to send additional/updated `extra` parameters after your
|
||||
first call `start` you can call `addExtraParameter`.
|
||||
> [!NOTE]
|
||||
> If you need to send additional/updated `extra` parameters after your
|
||||
> first call `start` you can call `addExtraParameter`.
|
||||
|
||||
**Note:** Parameters passed in `extra`, `globalExtra` or set with
|
||||
`addExtraParameter` have limits on the length of the keys and values. Key names
|
||||
must be at most 39 bytes long, and values must be no longer than 127 bytes.
|
||||
Keys with names longer than the maximum will be silently ignored. Key values
|
||||
longer than the maximum length will be truncated.
|
||||
> [!NOTE]
|
||||
> Parameters passed in `extra`, `globalExtra` or set with
|
||||
> `addExtraParameter` have limits on the length of the keys and values. Key names
|
||||
> must be at most 39 bytes long, and values must be no longer than 127 bytes.
|
||||
> Keys with names longer than the maximum will be silently ignored. Key values
|
||||
> longer than the maximum length will be truncated.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getLastCrashReport()`
|
||||
|
||||
@@ -105,7 +110,8 @@ last crash report. Only crash reports that have been uploaded will be returned;
|
||||
even if a crash report is present on disk it will not be returned until it is
|
||||
uploaded. In the case that there are no uploaded reports, `null` is returned.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getUploadedReports()`
|
||||
|
||||
@@ -114,14 +120,16 @@ Returns [`CrashReport[]`](structures/crash-report.md):
|
||||
Returns all uploaded crash reports. Each report contains the date and uploaded
|
||||
ID.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getUploadToServer()`
|
||||
|
||||
Returns `boolean` - Whether reports should be submitted to the server. Set through
|
||||
the `start` method or `setUploadToServer`.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.setUploadToServer(uploadToServer)`
|
||||
|
||||
@@ -130,7 +138,8 @@ the `start` method or `setUploadToServer`.
|
||||
This would normally be controlled by user preferences. This has no effect if
|
||||
called before `start` is called.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.addExtraParameter(key, value)`
|
||||
|
||||
@@ -148,10 +157,11 @@ with crashes from renderer or other child processes. Similarly, adding extra
|
||||
parameters in a renderer process will not result in those parameters being sent
|
||||
with crashes that occur in other renderer processes or in the main process.
|
||||
|
||||
**Note:** Parameters have limits on the length of the keys and values. Key
|
||||
names must be no longer than 39 bytes, and values must be no longer than 20320
|
||||
bytes. Keys with names longer than the maximum will be silently ignored. Key
|
||||
values longer than the maximum length will be truncated.
|
||||
> [!NOTE]
|
||||
> Parameters have limits on the length of the keys and values. Key
|
||||
> names must be no longer than 39 bytes, and values must be no longer than 20320
|
||||
> bytes. Keys with names longer than the maximum will be silently ignored. Key
|
||||
> values longer than the maximum length will be truncated.
|
||||
|
||||
### `crashReporter.removeExtraParameter(key)`
|
||||
|
||||
|
||||
@@ -70,8 +70,9 @@ stopButton.addEventListener('click', () => {
|
||||
|
||||
See [`navigator.mediaDevices.getDisplayMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia) for more information.
|
||||
|
||||
**Note:** `navigator.mediaDevices.getDisplayMedia` does not permit the use of `deviceId` for
|
||||
selection of a source - see [specification](https://w3c.github.io/mediacapture-screen-share/#constraints).
|
||||
> [!NOTE]
|
||||
> `navigator.mediaDevices.getDisplayMedia` does not permit the use of `deviceId` for
|
||||
> selection of a source - see [specification](https://w3c.github.io/mediacapture-screen-share/#constraints).
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -92,8 +93,9 @@ The `desktopCapturer` module has the following methods:
|
||||
|
||||
Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md) objects, each `DesktopCapturerSource` represents a screen or an individual window that can be captured.
|
||||
|
||||
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
|
||||
which can detected by [`systemPreferences.getMediaAccessStatus`][].
|
||||
> [!NOTE]
|
||||
> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
|
||||
> which can detected by [`systemPreferences.getMediaAccessStatus`][].
|
||||
|
||||
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
||||
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-windows-macos
|
||||
|
||||
@@ -67,10 +67,11 @@ The `extensions` array should contain extensions without wildcards or dots (e.g.
|
||||
`'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
|
||||
`'*'` wildcard (no other wildcard is supported).
|
||||
|
||||
**Note:** On Windows and Linux an open dialog can not be both a file selector
|
||||
and a directory selector, so if you set `properties` to
|
||||
`['openFile', 'openDirectory']` on these platforms, a directory selector will be
|
||||
shown.
|
||||
> [!NOTE]
|
||||
> On Windows and Linux an open dialog can not be both a file selector
|
||||
> and a directory selector, so if you set `properties` to
|
||||
> `['openFile', 'openDirectory']` on these platforms, a directory selector will be
|
||||
> shown.
|
||||
|
||||
```js @ts-type={mainWindow:Electron.BaseWindow}
|
||||
dialog.showOpenDialogSync(mainWindow, {
|
||||
@@ -78,10 +79,11 @@ dialog.showOpenDialogSync(mainWindow, {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** On Linux `defaultPath` is not supported when using portal file chooser
|
||||
dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
|
||||
[command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
to force gtk or kde dialogs.
|
||||
> [!NOTE]
|
||||
> On Linux `defaultPath` is not supported when using portal file chooser
|
||||
> dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
|
||||
> [command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
> to force gtk or kde dialogs.
|
||||
|
||||
### `dialog.showOpenDialog([window, ]options)`
|
||||
|
||||
@@ -139,10 +141,11 @@ The `extensions` array should contain extensions without wildcards or dots (e.g.
|
||||
`'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
|
||||
`'*'` wildcard (no other wildcard is supported).
|
||||
|
||||
**Note:** On Windows and Linux an open dialog can not be both a file selector
|
||||
and a directory selector, so if you set `properties` to
|
||||
`['openFile', 'openDirectory']` on these platforms, a directory selector will be
|
||||
shown.
|
||||
> [!NOTE]
|
||||
> On Windows and Linux an open dialog can not be both a file selector
|
||||
> and a directory selector, so if you set `properties` to
|
||||
> `['openFile', 'openDirectory']` on these platforms, a directory selector will be
|
||||
> shown.
|
||||
|
||||
```js @ts-type={mainWindow:Electron.BaseWindow}
|
||||
dialog.showOpenDialog(mainWindow, {
|
||||
@@ -155,10 +158,11 @@ dialog.showOpenDialog(mainWindow, {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** On Linux `defaultPath` is not supported when using portal file chooser
|
||||
dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
|
||||
[command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
to force gtk or kde dialogs.
|
||||
> [!NOTE]
|
||||
> On Linux `defaultPath` is not supported when using portal file chooser
|
||||
> dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
|
||||
> [command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
> to force gtk or kde dialogs.
|
||||
|
||||
### `dialog.showSaveDialogSync([window, ]options)`
|
||||
|
||||
@@ -225,8 +229,9 @@ The `window` argument allows the dialog to attach itself to a parent window, mak
|
||||
The `filters` specifies an array of file types that can be displayed, see
|
||||
`dialog.showOpenDialog` for an example.
|
||||
|
||||
**Note:** On macOS, using the asynchronous version is recommended to avoid issues when
|
||||
expanding and collapsing the dialog.
|
||||
> [!NOTE]
|
||||
> On macOS, using the asynchronous version is recommended to avoid issues when
|
||||
> expanding and collapsing the dialog.
|
||||
|
||||
### `dialog.showMessageBoxSync([window, ]options)`
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ When `informational` is passed, the dock icon will bounce for one second.
|
||||
However, the request remains active until either the application becomes active
|
||||
or the request is canceled.
|
||||
|
||||
**Note:** This method can only be used while the app is not focused; when the app is focused it will return -1.
|
||||
> [!NOTE]
|
||||
> This method can only be used while the app is not focused; when the app is focused it will return -1.
|
||||
|
||||
#### `dock.cancelBounce(id)` _macOS_
|
||||
|
||||
|
||||
@@ -115,7 +115,8 @@ Returns `boolean` - Whether the download is paused.
|
||||
|
||||
Resumes the download that has been paused.
|
||||
|
||||
**Note:** To enable resumable downloads the server you are downloading from must support range requests and provide both `Last-Modified` and `ETag` header values. Otherwise `resume()` will dismiss previously received bytes and restart the download from the beginning.
|
||||
> [!NOTE]
|
||||
> To enable resumable downloads the server you are downloading from must support range requests and provide both `Last-Modified` and `ETag` header values. Otherwise `resume()` will dismiss previously received bytes and restart the download from the beginning.
|
||||
|
||||
#### `downloadItem.canResume()`
|
||||
|
||||
@@ -141,9 +142,10 @@ Returns `boolean` - Whether the download has user gesture.
|
||||
|
||||
Returns `string` - The file name of the download item.
|
||||
|
||||
**Note:** The file name is not always the same as the actual one saved in local
|
||||
disk. If user changes the file name in a prompted download saving dialog, the
|
||||
actual name of saved file will be different.
|
||||
> [!NOTE]
|
||||
> The file name is not always the same as the actual one saved in local
|
||||
> disk. If user changes the file name in a prompted download saving dialog, the
|
||||
> actual name of saved file will be different.
|
||||
|
||||
#### `downloadItem.getCurrentBytesPerSecond()`
|
||||
|
||||
@@ -172,8 +174,9 @@ header.
|
||||
|
||||
Returns `string` - The current state. Can be `progressing`, `completed`, `cancelled` or `interrupted`.
|
||||
|
||||
**Note:** The following methods are useful specifically to resume a
|
||||
`cancelled` item when session is restarted.
|
||||
> [!NOTE]
|
||||
> The following methods are useful specifically to resume a
|
||||
> `cancelled` item when session is restarted.
|
||||
|
||||
#### `downloadItem.getURLChain()`
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ you would when running the normal Node.js executable, with the exception of the
|
||||
These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js'
|
||||
`crypto` module, and so will not work as designed.
|
||||
|
||||
If the [`runAsNode` fuse](../tutorial/fuses.md#L13) is disabled, `ELECTRON_RUN_AS_NODE` will be ignored.
|
||||
If the [`runAsNode` fuse](../tutorial/fuses.md#runasnode) is disabled, `ELECTRON_RUN_AS_NODE` will be ignored.
|
||||
|
||||
### `ELECTRON_NO_ATTACH_CONSOLE` _Windows_
|
||||
|
||||
|
||||
@@ -92,11 +92,13 @@ app.whenReady().then(async () => {
|
||||
|
||||
This API does not support loading packed (.crx) extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Note:** Loading extensions into in-memory (non-persistent) sessions is not
|
||||
supported and will throw an error.
|
||||
> [!NOTE]
|
||||
> Loading extensions into in-memory (non-persistent) sessions is not
|
||||
> supported and will throw an error.
|
||||
|
||||
#### `extensions.removeExtension(extensionId)`
|
||||
|
||||
@@ -104,8 +106,9 @@ supported and will throw an error.
|
||||
|
||||
Unloads an extension.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
#### `extensions.getExtension(extensionId)`
|
||||
|
||||
@@ -113,12 +116,14 @@ is emitted.
|
||||
|
||||
Returns `Extension | null` - The loaded extension with the given ID.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
#### `extensions.getAllExtensions()`
|
||||
|
||||
Returns `Extension[]` - A list of all loaded extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
@@ -6,7 +6,8 @@ but it also happens to support some other extension capabilities.
|
||||
|
||||
[chrome-extensions-api-index]: https://developer.chrome.com/extensions/api_index
|
||||
|
||||
> **Note:** Electron does not support arbitrary Chrome extensions from the
|
||||
> [!NOTE]
|
||||
> Electron does not support arbitrary Chrome extensions from the
|
||||
> store, and it is a **non-goal** of the Electron project to be perfectly
|
||||
> compatible with Chrome's implementation of Extensions.
|
||||
|
||||
@@ -160,7 +161,8 @@ The following methods of `chrome.tabs` are supported:
|
||||
- `chrome.tabs.update` (partial support)
|
||||
- supported properties: `url`, `muted`.
|
||||
|
||||
> **Note:** In Chrome, passing `-1` as a tab ID signifies the "currently active
|
||||
> [!NOTE]
|
||||
> In Chrome, passing `-1` as a tab ID signifies the "currently active
|
||||
> tab". Since Electron has no such concept, passing `-1` as a tab ID is not
|
||||
> supported and will raise an error.
|
||||
|
||||
@@ -170,6 +172,7 @@ See [official documentation](https://developer.chrome.com/docs/extensions/refere
|
||||
|
||||
All features of this API are supported.
|
||||
|
||||
> **NOTE:** Electron's [`webRequest`](web-request.md) module takes precedence over `chrome.webRequest` if there are conflicting handlers.
|
||||
> [!NOTE]
|
||||
> Electron's [`webRequest`](web-request.md) module takes precedence over `chrome.webRequest` if there are conflicting handlers.
|
||||
|
||||
See [official documentation](https://developer.chrome.com/docs/extensions/reference/webRequest) for more information.
|
||||
|
||||
@@ -8,13 +8,13 @@ The `globalShortcut` module can register/unregister a global keyboard shortcut
|
||||
with the operating system so that you can customize the operations for various
|
||||
shortcuts.
|
||||
|
||||
**Note:** The shortcut is global; it will work even if the app does
|
||||
not have the keyboard focus. This module cannot be used before the `ready`
|
||||
event of the app module is emitted.
|
||||
|
||||
Please also note that it is also possible to use Chromium's
|
||||
`GlobalShortcutsPortal` implementation, which allows apps to bind global
|
||||
shortcuts when running within a Wayland session.
|
||||
> [!NOTE]
|
||||
> The shortcut is global; it will work even if the app does
|
||||
> not have the keyboard focus. This module cannot be used before the `ready`
|
||||
> event of the app module is emitted.
|
||||
> Please also note that it is also possible to use Chromium's
|
||||
> `GlobalShortcutsPortal` implementation, which allows apps to bind global
|
||||
> shortcuts when running within a Wayland session.
|
||||
|
||||
```js
|
||||
const { app, globalShortcut } = require('electron')
|
||||
|
||||
65
docs/api/image-view.md
Normal file
65
docs/api/image-view.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# ImageView
|
||||
|
||||
> A View that displays an image.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
This module cannot be used until the `ready` event of the `app`
|
||||
module is emitted.
|
||||
|
||||
Useful for showing splash screens that will be swapped for `WebContentsView`s
|
||||
when the content finishes loading.
|
||||
|
||||
Note that `ImageView` is experimental and may be changed or removed in the future.
|
||||
|
||||
```js
|
||||
const { BaseWindow, ImageView, nativeImage, WebContentsView } = require('electron')
|
||||
const path = require('node:path')
|
||||
|
||||
const win = new BaseWindow({ width: 800, height: 600 })
|
||||
|
||||
// Create a "splash screen" image to display while the WebContentsView loads
|
||||
const splashView = new ImageView()
|
||||
const splashImage = nativeImage.createFromPath(path.join(__dirname, 'loading.png'))
|
||||
splashView.setImage(splashImage)
|
||||
win.setContentView(splashView)
|
||||
|
||||
const webContentsView = new WebContentsView()
|
||||
webContentsView.webContents.once('did-finish-load', () => {
|
||||
// Now that the WebContentsView has loaded, swap out the "splash screen" ImageView
|
||||
win.setContentView(webContentsView)
|
||||
})
|
||||
webContentsView.webContents.loadURL('https://electronjs.org')
|
||||
```
|
||||
|
||||
## Class: ImageView extends `View`
|
||||
|
||||
> A View that displays an image.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
`ImageView` inherits from [`View`](view.md).
|
||||
|
||||
`ImageView` is an [EventEmitter][event-emitter].
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new ImageView()` _Experimental_
|
||||
|
||||
Creates an ImageView.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of the `ImageView` class, in
|
||||
addition to those inherited from [View](view.md):
|
||||
|
||||
#### `image.setImage(image)` _Experimental_
|
||||
|
||||
* `image` NativeImage
|
||||
|
||||
Sets the image for this `ImageView`. Note that only image formats supported by
|
||||
`NativeImage` can be used with an `ImageView`.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
@@ -11,6 +11,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
<!-- TODO(samuelmaddock): refactor doc gen to allow generics to reduce duplication -->
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### Instance Methods
|
||||
|
||||
#### `ipcMainServiceWorker.on(channel, listener)`
|
||||
|
||||
@@ -156,7 +156,7 @@ If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRender
|
||||
|
||||
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects will throw an exception.
|
||||
>
|
||||
@@ -165,7 +165,7 @@ If you do not need a response to the message, consider using [`ipcRenderer.send`
|
||||
> Electron's IPC to the main process, as the main process would have no way to decode
|
||||
> them. Attempting to send such objects over IPC will result in an error.
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> If the handler in the main process throws an error,
|
||||
> the promise returned by `invoke` will reject.
|
||||
> However, the `Error` object in the renderer process
|
||||
@@ -195,7 +195,8 @@ throw an exception.
|
||||
The main process handles it by listening for `channel` with [`ipcMain`](./ipc-main.md) module,
|
||||
and replies by setting `event.returnValue`.
|
||||
|
||||
> :warning: **WARNING**: Sending a synchronous message will block the whole
|
||||
> [!WARNING]
|
||||
> Sending a synchronous message will block the whole
|
||||
> renderer process until the reply is received, so use this method only as a
|
||||
> last resort. It's much better to use the asynchronous version,
|
||||
> [`invoke()`](./ipc-renderer.md#ipcrendererinvokechannel-args).
|
||||
|
||||
@@ -6,6 +6,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
See [`Menu`](menu.md) for examples.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new MenuItem(options)`
|
||||
|
||||
* `options` Object
|
||||
@@ -16,10 +20,16 @@ See [`Menu`](menu.md) for examples.
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `role` string (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
`click` property will be ignored. See [roles](#roles).
|
||||
* `type` string (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
||||
`radio`.
|
||||
* `type` string (optional)
|
||||
* `normal`
|
||||
* `separator`
|
||||
* `submenu`
|
||||
* `checkbox`
|
||||
* `radio`
|
||||
* `header` - Only available on macOS 14 and up.
|
||||
* `palette` - Only available on macOS 14 and up.
|
||||
* `label` string (optional)
|
||||
* `sublabel` string (optional)
|
||||
* `sublabel` string (optional) _macOS_ - Available in macOS >= 14.4
|
||||
* `toolTip` string (optional) _macOS_ - Hover text for this menu item.
|
||||
* `accelerator` [Accelerator](accelerator.md) (optional)
|
||||
* `icon` ([NativeImage](native-image.md) | string) (optional)
|
||||
@@ -51,7 +61,8 @@ See [`Menu`](menu.md) for examples.
|
||||
the placement of their containing group after the containing group of the item
|
||||
with the specified id.
|
||||
|
||||
**Note:** `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
|
||||
> [!NOTE]
|
||||
> `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
|
||||
|
||||
### Roles
|
||||
|
||||
@@ -125,7 +136,8 @@ When specifying a `role` on macOS, `label` and `accelerator` are the only
|
||||
options that will affect the menu item. All other options will be ignored.
|
||||
Lowercase `role`, e.g. `toggledevtools`, is still supported.
|
||||
|
||||
**Note:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
|
||||
> [!NOTE]
|
||||
> The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
@@ -156,7 +168,10 @@ item's submenu, if present.
|
||||
|
||||
#### `menuItem.type`
|
||||
|
||||
A `string` indicating the type of the item. Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
|
||||
A `string` indicating the type of the item. Can be `normal`, `separator`, `submenu`, `checkbox`, `radio`, `header` or `palette`.
|
||||
|
||||
> [!NOTE]
|
||||
> `header` and `palette` are only available on macOS 14 and up.
|
||||
|
||||
#### `menuItem.role`
|
||||
|
||||
@@ -170,7 +185,8 @@ An `Accelerator` (optional) indicating the item's accelerator, if set.
|
||||
|
||||
An `Accelerator | null` indicating the item's [user-assigned accelerator](https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc) for the menu item.
|
||||
|
||||
**Note:** This property is only initialized after the `MenuItem` has been added to a `Menu`. Either via `Menu.buildFromTemplate` or via `Menu.append()/insert()`. Accessing before initialization will just return `null`.
|
||||
> [!NOTE]
|
||||
> This property is only initialized after the `MenuItem` has been added to a `Menu`. Either via `Menu.buildFromTemplate` or via `Menu.append()/insert()`. Accessing before initialization will just return `null`.
|
||||
|
||||
#### `menuItem.icon`
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new Menu()`
|
||||
|
||||
Creates a new menu.
|
||||
@@ -32,16 +36,18 @@ In order to escape the `&` character in an item name, add a proceeding `&`. For
|
||||
Passing `null` will suppress the default menu. On Windows and Linux,
|
||||
this has the additional effect of removing the menu bar from the window.
|
||||
|
||||
**Note:** The default menu will be created automatically if the app does not set one.
|
||||
It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
|
||||
> [!NOTE]
|
||||
> The default menu will be created automatically if the app does not set one.
|
||||
> It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
|
||||
|
||||
#### `Menu.getApplicationMenu()`
|
||||
|
||||
Returns `Menu | null` - The application menu, if set, or `null`, if not set.
|
||||
|
||||
**Note:** The returned `Menu` instance doesn't support dynamic addition or
|
||||
removal of menu items. [Instance properties](#instance-properties) can still
|
||||
be dynamically modified.
|
||||
> [!NOTE]
|
||||
> The returned `Menu` instance doesn't support dynamic addition or
|
||||
> removal of menu items. [Instance properties](#instance-properties) can still
|
||||
> be dynamically modified.
|
||||
|
||||
#### `Menu.sendActionToFirstResponder(action)` _macOS_
|
||||
|
||||
@@ -119,8 +125,9 @@ Inserts the `menuItem` to the `pos` position of the menu.
|
||||
|
||||
Objects created with `new Menu` or returned by `Menu.buildFromTemplate` emit the following events:
|
||||
|
||||
**Note:** Some events are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some events are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
#### Event: 'menu-will-show'
|
||||
|
||||
@@ -329,6 +336,27 @@ name, no matter what label you set. To change it, modify your app bundle's
|
||||
[About Information Property List Files][AboutInformationPropertyListFiles]
|
||||
for more information.
|
||||
|
||||
### Menu Sublabels
|
||||
|
||||
Menu sublabels, or [subtitles](https://developer.apple.com/documentation/appkit/nsmenuitem/subtitle?language=objc), can be added to menu items using the `sublabel` option. Below is an example based on the renderer example above:
|
||||
|
||||
```js @ts-expect-error=[12]
|
||||
// main
|
||||
ipcMain.on('show-context-menu', (event) => {
|
||||
const template = [
|
||||
{
|
||||
label: 'Menu Item 1',
|
||||
sublabel: 'Subtitle 1',
|
||||
click: () => { event.sender.send('context-menu-command', 'menu-item-1') }
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{ label: 'Menu Item 2', sublabel: 'Subtitle 2', type: 'checkbox', checked: true }
|
||||
]
|
||||
const menu = Menu.buildFromTemplate(template)
|
||||
menu.popup({ window: BrowserWindow.fromWebContents(event.sender) })
|
||||
})
|
||||
```
|
||||
|
||||
## Setting Menu for Specific Browser Window (_Linux_ _Windows_)
|
||||
|
||||
The [`setMenu` method][setMenu] of browser windows can set the menu of certain
|
||||
|
||||
@@ -33,6 +33,10 @@ ipcRenderer.on('port', (e) => {
|
||||
})
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
#### `channel.port1`
|
||||
|
||||
@@ -134,7 +134,8 @@ Creates an empty `NativeImage` instance.
|
||||
|
||||
Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview image, which is a [NativeImage](native-image.md).
|
||||
|
||||
Note: The Windows implementation will ignore `size.height` and scale the height according to `size.width`.
|
||||
> [!NOTE]
|
||||
> Windows implementation will ignore `size.height` and scale the height according to `size.width`.
|
||||
|
||||
### `nativeImage.createFromPath(path)`
|
||||
|
||||
@@ -142,8 +143,8 @@ Note: The Windows implementation will ignore `size.height` and scale the height
|
||||
|
||||
Returns `NativeImage`
|
||||
|
||||
Creates a new `NativeImage` instance from a file located at `path`. This method
|
||||
returns an empty image if the `path` does not exist, cannot be read, or is not
|
||||
Creates a new `NativeImage` instance from an image file (e.g., PNG or JPEG) located at `path`.
|
||||
This method returns an empty image if the `path` does not exist, cannot be read, or is not
|
||||
a valid image.
|
||||
|
||||
```js
|
||||
|
||||
@@ -17,8 +17,9 @@ app.whenReady().then(async () => {
|
||||
|
||||
See [`--log-net-log`](command-line-switches.md#--log-net-logpath) to log network events throughout the app's lifecycle.
|
||||
|
||||
**Note:** All methods unless specified can only be used after the `ready` event
|
||||
of the `app` module gets emitted.
|
||||
> [!NOTE]
|
||||
> All methods unless specified can only be used after the `ready` event
|
||||
> of the `app` module gets emitted.
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -117,8 +117,9 @@ protocol.handle('https', (req) => {
|
||||
})
|
||||
```
|
||||
|
||||
Note: in the [utility process](../glossary.md#utility-process) custom protocols
|
||||
are not supported.
|
||||
> [!NOTE]
|
||||
> In the [utility process](../glossary.md#utility-process), custom protocols
|
||||
> are not supported.
|
||||
|
||||
### `net.isOnline()`
|
||||
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
:::info Renderer process notifications
|
||||
|
||||
If you want to show notifications from a renderer process you should use the
|
||||
[web Notifications API](../tutorial/notifications.md)
|
||||
|
||||
:::
|
||||
> [!NOTE]
|
||||
> If you want to show notifications from a renderer process you should use the
|
||||
> [web Notifications API](../tutorial/notifications.md)
|
||||
|
||||
## Class: Notification
|
||||
|
||||
@@ -21,6 +18,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
It creates a new `Notification` with native properties as set by the `options`.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### Static Methods
|
||||
|
||||
The `Notification` class has the following static methods:
|
||||
|
||||
@@ -33,10 +33,11 @@ Returns `Integer` - The blocker ID that is assigned to this power blocker.
|
||||
Starts preventing the system from entering lower-power mode. Returns an integer
|
||||
identifying the power save blocker.
|
||||
|
||||
**Note:** `prevent-display-sleep` has higher precedence over
|
||||
`prevent-app-suspension`. Only the highest precedence type takes effect. In
|
||||
other words, `prevent-display-sleep` always takes precedence over
|
||||
`prevent-app-suspension`.
|
||||
> [!NOTE]
|
||||
> `prevent-display-sleep` has higher precedence over
|
||||
> `prevent-app-suspension`. Only the highest precedence type takes effect. In
|
||||
> other words, `prevent-display-sleep` always takes precedence over
|
||||
> `prevent-app-suspension`.
|
||||
|
||||
For example, an API calling A requests for `prevent-app-suspension`, and
|
||||
another calling B requests for `prevent-display-sleep`. `prevent-display-sleep`
|
||||
|
||||
@@ -233,7 +233,8 @@ console.log(version)
|
||||
// On Linux -> '4.15.0-45-generic'
|
||||
```
|
||||
|
||||
**Note:** It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.
|
||||
> [!NOTE]
|
||||
> It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.
|
||||
|
||||
### `process.takeHeapSnapshot(filePath)`
|
||||
|
||||
|
||||
@@ -20,8 +20,9 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** All methods unless specified can only be used after the `ready` event
|
||||
of the `app` module gets emitted.
|
||||
> [!NOTE]
|
||||
> All methods unless specified can only be used after the `ready` event
|
||||
> of the `app` module gets emitted.
|
||||
|
||||
## Using `protocol` with a custom `partition` or `session`
|
||||
|
||||
@@ -61,8 +62,9 @@ The `protocol` module has the following methods:
|
||||
|
||||
* `customSchemes` [CustomScheme[]](structures/custom-scheme.md)
|
||||
|
||||
**Note:** This method can only be used before the `ready` event of the `app`
|
||||
module gets emitted and can be called only once.
|
||||
> [!NOTE]
|
||||
> This method can only be used before the `ready` event of the `app`
|
||||
> module gets emitted and can be called only once.
|
||||
|
||||
Registers the `scheme` as standard, secure, bypasses content security policy for
|
||||
resources, allows registering ServiceWorker, supports fetch API, streaming
|
||||
|
||||
@@ -73,5 +73,6 @@ command line flag is provided `--password-store="basic"`.
|
||||
is provided `--password-store="kwallet"`.
|
||||
* `kwallet5` - When the desktop session is `kde5` or if the following command line flag
|
||||
is provided `--password-store="kwallet5"`.
|
||||
* `kwallet6` - When the desktop session is `kde6`.
|
||||
* `kwallet6` - When the desktop session is `kde6` or if the following command line flag
|
||||
is provided `--password-store="kwallet6"`.
|
||||
* `unknown` - When the function is called before app has emitted the `ready` event.
|
||||
|
||||
@@ -9,8 +9,9 @@ module is emitted.
|
||||
|
||||
`screen` is an [EventEmitter][event-emitter].
|
||||
|
||||
**Note:** In the renderer / DevTools, `window.screen` is a reserved DOM
|
||||
property, so writing `let { screen } = require('electron')` will not work.
|
||||
> [!NOTE]
|
||||
> In the renderer / DevTools, `window.screen` is a reserved DOM
|
||||
> property, so writing `let { screen } = require('electron')` will not work.
|
||||
|
||||
An example of creating a window that fills the whole screen:
|
||||
|
||||
@@ -57,6 +58,14 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Screen coordinates used by this module are [`Point`](structures/point.md) structures.
|
||||
> There are two kinds of coordinates available to the process:
|
||||
>
|
||||
> * **Physical screen points** are raw hardware pixels on a display.
|
||||
> * **Device-independent pixel (DIP) points** are virtualized screen points scaled based on the DPI
|
||||
> (dots per inch) of the display.
|
||||
|
||||
## Events
|
||||
|
||||
The `screen` module emits the following events:
|
||||
@@ -101,7 +110,8 @@ Returns [`Point`](structures/point.md)
|
||||
|
||||
The current absolute position of the mouse pointer.
|
||||
|
||||
**Note:** The return value is a DIP point, not a screen physical point.
|
||||
> [!NOTE]
|
||||
> The return value is a DIP point, not a screen physical point.
|
||||
|
||||
### `screen.getPrimaryDisplay()`
|
||||
|
||||
@@ -124,7 +134,7 @@ Returns [`Display`](structures/display.md) - The display nearest the specified p
|
||||
Returns [`Display`](structures/display.md) - The display that most closely
|
||||
intersects the provided bounds.
|
||||
|
||||
### `screen.screenToDipPoint(point)` _Windows_
|
||||
### `screen.screenToDipPoint(point)` _Windows_ _Linux_
|
||||
|
||||
* `point` [Point](structures/point.md)
|
||||
|
||||
@@ -133,7 +143,10 @@ Returns [`Point`](structures/point.md)
|
||||
Converts a screen physical point to a screen DIP point.
|
||||
The DPI scale is performed relative to the display containing the physical point.
|
||||
|
||||
### `screen.dipToScreenPoint(point)` _Windows_
|
||||
Not currently supported on Wayland - if used there it will return the point passed
|
||||
in with no changes.
|
||||
|
||||
### `screen.dipToScreenPoint(point)` _Windows_ _Linux_
|
||||
|
||||
* `point` [Point](structures/point.md)
|
||||
|
||||
@@ -142,6 +155,8 @@ Returns [`Point`](structures/point.md)
|
||||
Converts a screen DIP point to a screen physical point.
|
||||
The DPI scale is performed relative to the display containing the DIP point.
|
||||
|
||||
Not currently supported on Wayland.
|
||||
|
||||
### `screen.screenToDipRect(window, rect)` _Windows_
|
||||
|
||||
* `window` [BrowserWindow](browser-window.md) | null
|
||||
|
||||
@@ -762,7 +762,8 @@ Preconnects the given number of sockets to an origin.
|
||||
|
||||
Returns `Promise<void>` - Resolves when all connections are closed.
|
||||
|
||||
**Note:** It will terminate / fail all requests currently in flight.
|
||||
> [!NOTE]
|
||||
> It will terminate / fail all requests currently in flight.
|
||||
|
||||
#### `ses.fetch(input[, init])`
|
||||
|
||||
@@ -1305,8 +1306,9 @@ Initiates a download of the resource at `url`.
|
||||
The API will generate a [DownloadItem](download-item.md) that can be accessed
|
||||
with the [will-download](#event-will-download) event.
|
||||
|
||||
**Note:** This does not perform any security checks that relate to a page's origin,
|
||||
unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl-options).
|
||||
> [!NOTE]
|
||||
> This does not perform any security checks that relate to a page's origin,
|
||||
> unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl-options).
|
||||
|
||||
#### `ses.createInterruptedDownload(options)`
|
||||
|
||||
@@ -1434,7 +1436,8 @@ The built in spellchecker does not automatically detect what language a user is
|
||||
spell checker to correctly check their words you must call this API with an array of language codes. You can
|
||||
get the list of supported language codes with the `ses.availableSpellCheckerLanguages` property.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.
|
||||
> [!NOTE]
|
||||
> On macOS, the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.getSpellCheckerLanguages()`
|
||||
|
||||
@@ -1442,7 +1445,8 @@ Returns `string[]` - An array of language codes the spellchecker is enabled for.
|
||||
will fallback to using `en-US`. By default on launch if this setting is an empty list Electron will try to populate this
|
||||
setting with the current OS locale. This setting is persisted across restarts.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and has its own list of languages. On macOS, this API will return whichever languages have been configured by the OS.
|
||||
> [!NOTE]
|
||||
> On macOS, the OS spellchecker is used and has its own list of languages. On macOS, this API will return whichever languages have been configured by the OS.
|
||||
|
||||
#### `ses.setSpellCheckerDictionaryDownloadURL(url)`
|
||||
|
||||
@@ -1460,7 +1464,8 @@ If the files present in `hunspell_dictionaries.zip` are available at `https://ex
|
||||
then you should call this api with `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`. Please
|
||||
note the trailing slash. The URL to the dictionaries is formed as `${url}${filename}`.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and therefore we do not download any dictionary files. This API is a no-op on macOS.
|
||||
> [!NOTE]
|
||||
> On macOS, the OS spellchecker is used and therefore we do not download any dictionary files. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.listWordsInSpellCheckerDictionary()`
|
||||
|
||||
@@ -1474,7 +1479,8 @@ Resolves when the full dictionary is loaded from disk.
|
||||
Returns `boolean` - Whether the word was successfully written to the custom dictionary. This API
|
||||
will not work on non-persistent (in-memory) sessions.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be written to the OS custom dictionary as well
|
||||
> [!NOTE]
|
||||
> On macOS and Windows, this word will be written to the OS custom dictionary as well.
|
||||
|
||||
#### `ses.removeWordFromSpellCheckerDictionary(word)`
|
||||
|
||||
@@ -1483,7 +1489,8 @@ will not work on non-persistent (in-memory) sessions.
|
||||
Returns `boolean` - Whether the word was successfully removed from the custom dictionary. This API
|
||||
will not work on non-persistent (in-memory) sessions.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be removed from the OS custom dictionary as well
|
||||
> [!NOTE]
|
||||
> On macOS and Windows, this word will be removed from the OS custom dictionary as well.
|
||||
|
||||
#### `ses.loadExtension(path[, options])` _Deprecated_
|
||||
|
||||
@@ -1526,11 +1533,13 @@ app.whenReady().then(async () => {
|
||||
|
||||
This API does not support loading packed (.crx) extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Note:** Loading extensions into in-memory (non-persistent) sessions is not
|
||||
supported and will throw an error.
|
||||
> [!NOTE]
|
||||
> Loading extensions into in-memory (non-persistent) sessions is not
|
||||
> supported and will throw an error.
|
||||
|
||||
**Deprecated:** Use the new `ses.extensions.loadExtension` API.
|
||||
|
||||
@@ -1540,8 +1549,9 @@ supported and will throw an error.
|
||||
|
||||
Unloads an extension.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Deprecated:** Use the new `ses.extensions.removeExtension` API.
|
||||
|
||||
@@ -1551,8 +1561,9 @@ is emitted.
|
||||
|
||||
Returns `Extension | null` - The loaded extension with the given ID.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Deprecated:** Use the new `ses.extensions.getExtension` API.
|
||||
|
||||
@@ -1560,8 +1571,9 @@ is emitted.
|
||||
|
||||
Returns `Extension[]` - A list of all loaded extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Deprecated:** Use the new `ses.extensions.getAllExtensions` API.
|
||||
|
||||
@@ -1599,9 +1611,11 @@ Clears various different types of data.
|
||||
This method clears more types of data and is more thorough than the
|
||||
`clearStorageData` method.
|
||||
|
||||
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
||||
> [!NOTE]
|
||||
> Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
||||
|
||||
**Note:** Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
|
||||
> [!NOTE]
|
||||
> Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
|
||||
|
||||
For more information, refer to Chromium's [`BrowsingDataRemover` interface][browsing-data-remover].
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ For including the share menu as a submenu of other menus, please use the
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new ShareMenu(sharingItem)`
|
||||
|
||||
* `sharingItem` SharingItem - The item to share.
|
||||
|
||||
@@ -14,7 +14,8 @@ const { shell } = require('electron')
|
||||
shell.openExternal('https://github.com')
|
||||
```
|
||||
|
||||
**Note:** While the `shell` module can be used in the renderer process, it will not function in a sandboxed renderer.
|
||||
> [!WARNING]
|
||||
> While the `shell` module can be used in the renderer process, it will not function in a sandboxed renderer.
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `symbolColor` String (optional) _Windows_ _Linux_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
|
||||
* `accentColor` boolean | string (optional) _Windows_ - The accent color for the window. By default, follows user preference in System Settings. Set to `false` to explicitly disable, or set the color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha values will be ignored.
|
||||
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
|
||||
Set a custom position for the traffic light buttons in frameless windows.
|
||||
* `roundedCorners` boolean (optional) _macOS_ _Windows_ - Whether frameless window
|
||||
|
||||
@@ -6,3 +6,11 @@
|
||||
* `productId` Integer - The USB product ID.
|
||||
* `serialNumber` string (optional) - The USB device serial number.
|
||||
* `guid` string (optional) - Unique identifier for the HID interface. A device may have multiple HID interfaces.
|
||||
* `collections` Object[] - an array of report formats. See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/collections) for more.
|
||||
* `usage` Integer - An integer representing the usage ID component of the HID usage associated with this collection.
|
||||
* `usagePage` Integer - An integer representing the usage page component of the HID usage associated with this collection.
|
||||
* `type` Integer - An 8-bit value representing the collection type, which describes a different relationship between the grouped items.
|
||||
* `children` Object[] - An array of sub-collections which takes the same format as a top-level collection.
|
||||
* `inputReports` Object[] - An array of inputReport items which represent individual input reports described in this collection.
|
||||
* `outputReports` Object[] - An array of outputReport items which represent individual output reports described in this collection.
|
||||
* `featureReports` Object[] - An array of featureReport items which represent individual feature reports described in this collection.
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
* `items` JumpListItem[] (optional) - Array of [`JumpListItem`](jump-list-item.md) objects if `type` is `tasks` or
|
||||
`custom`, otherwise it should be omitted.
|
||||
|
||||
**Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
|
||||
property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
is set but the `type` property is omitted then the `type` is assumed to be
|
||||
`custom`.
|
||||
> [!NOTE]
|
||||
> If a `JumpListCategory` object has neither the `type` nor the `name`
|
||||
> property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
> is set but the `type` property is omitted then the `type` is assumed to be
|
||||
> `custom`.
|
||||
|
||||
**Note:** The maximum length of a Jump List item's `description` property is
|
||||
260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
List, nor will it be displayed.
|
||||
> [!NOTE]
|
||||
> The maximum length of a Jump List item's `description` property is
|
||||
> 260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
> List, nor will it be displayed.
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* `x` number
|
||||
* `y` number
|
||||
|
||||
**Note:** Both `x` and `y` must be whole integers, when providing a point object
|
||||
as input to an Electron API we will automatically round your `x` and `y` values
|
||||
to the nearest whole integer.
|
||||
> [!NOTE]
|
||||
> Both `x` and `y` must be whole integers, when providing a point object
|
||||
> as input to an Electron API we will automatically round your `x` and `y` values
|
||||
> to the nearest whole integer.
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
> from Chromium at the space indicated by the proxy. By default, this proxy is added
|
||||
> to each TouchBar at the end of the input. For more information, see the AppKit docs on
|
||||
> [NSTouchBarItemIdentifierOtherItemsProxy](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy)
|
||||
>
|
||||
> Note: Only one instance of this class can be added per TouchBar.
|
||||
|
||||
> [!NOTE]
|
||||
> Only one instance of this class can be added per TouchBar.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)<br />
|
||||
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# TouchBar
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
## Class: TouchBar
|
||||
|
||||
> Create TouchBar layouts for native macOS applications
|
||||
@@ -15,12 +19,14 @@ Process: [Main](../glossary.md#main-process)
|
||||
Creates a new touch bar with the specified items. Use
|
||||
`BrowserWindow.setTouchBar` to add the `TouchBar` to a window.
|
||||
|
||||
**Note:** The TouchBar API is currently experimental and may change or be
|
||||
removed in future Electron releases.
|
||||
> [!NOTE]
|
||||
> The TouchBar API is currently experimental and may change or be
|
||||
> removed in future Electron releases.
|
||||
|
||||
**Tip:** If you don't have a MacBook with Touch Bar, you can use
|
||||
[Touch Bar Simulator](https://github.com/sindresorhus/touch-bar-simulator)
|
||||
to test Touch Bar usage in your app.
|
||||
> [!TIP]
|
||||
> If you don't have a MacBook with Touch Bar, you can use
|
||||
> [Touch Bar Simulator](https://github.com/sindresorhus/touch-bar-simulator)
|
||||
> to test Touch Bar usage in your app.
|
||||
|
||||
### Static Properties
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
**Platform Considerations**
|
||||
|
||||
**Linux**
|
||||
@@ -176,7 +180,8 @@ Returns:
|
||||
|
||||
Emitted when the mouse is released from clicking the tray icon.
|
||||
|
||||
Note: This will not be emitted if you have set a context menu for your Tray using `tray.setContextMenu`, as a result of macOS-level constraints.
|
||||
> [!NOTE]
|
||||
> This will not be emitted if you have set a context menu for your Tray using `tray.setContextMenu`, as a result of macOS-level constraints.
|
||||
|
||||
#### Event: 'mouse-down' _macOS_
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ Process: [Main](../glossary.md#main-process)<br />
|
||||
|
||||
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
|
||||
|
||||
**Note:** `utilityProcess.fork` can only be called after the `ready` event has been emitted on `App`.
|
||||
> [!NOTE]
|
||||
> `utilityProcess.fork` can only be called after the `ready` event has been emitted on `App`.
|
||||
|
||||
## Class: UtilityProcess
|
||||
|
||||
@@ -108,7 +109,8 @@ child.on('exit', () => {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** You can use the `pid` to determine if the process is currently running.
|
||||
> [!NOTE]
|
||||
> You can use the `pid` to determine if the process is currently running.
|
||||
|
||||
#### `child.stdout`
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
`View` is an [EventEmitter][event-emitter].
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new View()`
|
||||
|
||||
Creates a new `View`.
|
||||
@@ -94,13 +98,15 @@ Examples of valid `color` values:
|
||||
* Similar to CSS Color Module Level 3 keywords, but case-sensitive.
|
||||
* e.g. `blueviolet` or `red`
|
||||
|
||||
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
|
||||
> [!NOTE]
|
||||
> Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
|
||||
|
||||
#### `view.setBorderRadius(radius)`
|
||||
|
||||
* `radius` Integer - Border radius size in pixels.
|
||||
|
||||
**Note:** The area cutout of the view's border still captures clicks.
|
||||
> [!NOTE]
|
||||
> The area cutout of the view's border still captures clicks.
|
||||
|
||||
#### `view.setVisible(visible)`
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
`WebContentsView` is an [EventEmitter][event-emitter].
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new WebContentsView([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
|
||||
@@ -463,7 +463,8 @@ win.webContents.on('will-prevent-unload', (event) => {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** This will be emitted for `BrowserViews` but will _not_ be respected - this is because we have chosen not to tie the `BrowserView` lifecycle to its owning BrowserWindow should one exist per the [specification](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event).
|
||||
> [!NOTE]
|
||||
> This will be emitted for `BrowserViews` but will _not_ be respected - this is because we have chosen not to tie the `BrowserView` lifecycle to its owning BrowserWindow should one exist per the [specification](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event).
|
||||
|
||||
#### Event: 'render-process-gone'
|
||||
|
||||
@@ -533,14 +534,55 @@ To only prevent the menu shortcuts, use
|
||||
[`setIgnoreMenuShortcuts`](#contentssetignoremenushortcutsignore):
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
|
||||
win.webContents.on('before-input-event', (event, input) => {
|
||||
// For example, only enable application menu keyboard shortcuts when
|
||||
// Ctrl/Cmd are down.
|
||||
win.webContents.setIgnoreMenuShortcuts(!input.control && !input.meta)
|
||||
win.webContents.on('before-input-event', (event, input) => {
|
||||
// Enable application menu keyboard shortcuts when Ctrl/Cmd are down.
|
||||
win.webContents.setIgnoreMenuShortcuts(!input.control && !input.meta)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'before-mouse-event'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `mouse` [MouseInputEvent](structures/mouse-input-event.md)
|
||||
|
||||
Emitted before dispatching mouse events in the page.
|
||||
|
||||
Calling `event.preventDefault` will prevent the page mouse events.
|
||||
|
||||
```js
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
|
||||
win.webContents.on('before-mouse-event', (event, mouse) => {
|
||||
// Prevent mouseDown events.
|
||||
if (mouse.type === 'mouseDown') {
|
||||
console.log(mouse)
|
||||
/*
|
||||
{
|
||||
type: 'mouseDown',
|
||||
clickCount: 1,
|
||||
movementX: 0,
|
||||
movementY: 0,
|
||||
button: 'left',
|
||||
x: 632.359375,
|
||||
y: 480.6875,
|
||||
globalX: 168.359375,
|
||||
globalY: 193.6875
|
||||
}
|
||||
*/
|
||||
event.preventDefault()
|
||||
}
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
@@ -838,9 +880,10 @@ Emitted when a bluetooth device needs to be selected when a call to
|
||||
the `deviceId` of the device to be selected. Passing an empty string to
|
||||
`callback` will cancel the request.
|
||||
|
||||
If an event listener is not added for this event, or if `event.preventDefault`
|
||||
is not called when handling this event, the first available device will be
|
||||
automatically selected.
|
||||
If no event listener is added for this event, all bluetooth requests will be cancelled.
|
||||
|
||||
If `event.preventDefault` is not called when handling this event, the first available
|
||||
device will be automatically selected.
|
||||
|
||||
Due to the nature of bluetooth, scanning for devices when
|
||||
`navigator.bluetooth.requestDevice` is called may take time and will cause
|
||||
@@ -1491,7 +1534,8 @@ increment above or below represents zooming 20% larger or smaller to default
|
||||
limits of 300% and 50% of original size, respectively. The formula for this is
|
||||
`scale := 1.2 ^ level`.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> [!NOTE]
|
||||
> The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
@@ -1508,7 +1552,8 @@ Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum pinch-to-zoom level.
|
||||
|
||||
> **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it, call:
|
||||
> [!NOTE]
|
||||
> Visual zoom is disabled by default in Electron. To re-enable it, call:
|
||||
>
|
||||
> ```js
|
||||
> const win = new BrowserWindow()
|
||||
@@ -2076,7 +2121,9 @@ Disable device emulation enabled by `webContents.enableDeviceEmulation`.
|
||||
* `inputEvent` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)
|
||||
|
||||
Sends an input `event` to the page.
|
||||
**Note:** The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for
|
||||
|
||||
> [!NOTE]
|
||||
> The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for
|
||||
`sendInputEvent()` to work.
|
||||
|
||||
#### `contents.beginFrameSubscription([onlyDirty ,]callback)`
|
||||
@@ -2218,7 +2265,9 @@ By default this value is `{ min: 0, max: 0 }` , which would apply no restriction
|
||||
* `max` Integer - The maximum UDP port number that WebRTC should use.
|
||||
|
||||
Setting the WebRTC UDP Port Range allows you to restrict the udp port range used by WebRTC. By default the port range is unrestricted.
|
||||
**Note:** To reset to an unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
|
||||
|
||||
> [!NOTE]
|
||||
> To reset to an unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
|
||||
|
||||
#### `contents.getMediaSourceId(requestWebContents)`
|
||||
|
||||
@@ -2364,8 +2413,9 @@ A [`WebContents`](web-contents.md) instance that might own this `WebContents`.
|
||||
|
||||
A `WebContents | null` property that represents the of DevTools `WebContents` associated with a given `WebContents`.
|
||||
|
||||
**Note:** Users should never store this object because it may become `null`
|
||||
when the DevTools has been closed.
|
||||
> [!NOTE]
|
||||
> Users should never store this object because it may become `null`
|
||||
> when the DevTools has been closed.
|
||||
|
||||
#### `contents.debugger` _Readonly_
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ Changes the zoom level to the specified level. The original size is 0 and each
|
||||
increment above or below represents zooming 20% larger or smaller to default
|
||||
limits of 300% and 50% of original size, respectively.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> [!NOTE]
|
||||
> The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
@@ -56,13 +57,15 @@ Returns `number` - The current zoom level.
|
||||
|
||||
Sets the maximum and minimum pinch-to-zoom level.
|
||||
|
||||
> **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it, call:
|
||||
> [!NOTE]
|
||||
> Visual zoom is disabled by default in Electron. To re-enable it, call:
|
||||
>
|
||||
> ```js
|
||||
> webFrame.setVisualZoomLevelLimits(1, 3)
|
||||
> ```
|
||||
|
||||
> **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are
|
||||
> [!NOTE]
|
||||
> Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are
|
||||
> controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application
|
||||
> Menu. To disable shortcuts, manually [define the Menu](./menu.md#examples) and omit zoom roles
|
||||
> from the definition.
|
||||
@@ -189,7 +192,9 @@ dispatch errors of isolated worlds to foreign worlds.
|
||||
* `name` string (optional) - Name for isolated world. Useful in devtools.
|
||||
|
||||
Set the security origin, content security policy and name of the isolated world.
|
||||
Note: If the `csp` is specified, then the `securityOrigin` also has to be specified.
|
||||
|
||||
> [!NOTE]
|
||||
> If the `csp` is specified, then the `securityOrigin` also has to be specified.
|
||||
|
||||
### `webFrame.getResourceUsage()`
|
||||
|
||||
|
||||
@@ -30,8 +30,10 @@ rendered.
|
||||
Unlike an `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. **Note:** Most methods called on the
|
||||
webview from the host page require a synchronous call to the main process.
|
||||
safe from the embedded content.
|
||||
|
||||
> [!NOTE]
|
||||
> Most methods called on the webview from the host page require a synchronous call to the main process.
|
||||
|
||||
## Example
|
||||
|
||||
@@ -252,7 +254,8 @@ The full list of supported feature strings can be found in the
|
||||
|
||||
The `webview` tag has the following methods:
|
||||
|
||||
**Note:** The webview element must be loaded before using the methods.
|
||||
> [!NOTE]
|
||||
> The webview element must be loaded before using the methods.
|
||||
|
||||
**Example**
|
||||
|
||||
@@ -679,7 +682,8 @@ increment above or below represents zooming 20% larger or smaller to default
|
||||
limits of 300% and 50% of original size, respectively. The formula for this is
|
||||
`scale := 1.2 ^ level`.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> [!NOTE]
|
||||
> The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
|
||||
@@ -27,6 +27,16 @@ process.on('unhandledRejection', () => {
|
||||
})
|
||||
```
|
||||
|
||||
### Behavior Changed: `process.exit()` kills utility process synchronously
|
||||
|
||||
Calling `process.exit()` in a utility process will now kill the utility process synchronously.
|
||||
This brings the behavior of `process.exit()` in line with Node.js behavior.
|
||||
|
||||
Please refer to the
|
||||
[Node.js docs](https://nodejs.org/docs/latest-v22.x/api/process.html#processexitcode) and
|
||||
[PR #45690](https://github.com/electron/electron/pull/45690) to understand the potential
|
||||
implications of that, e.g., when calling `console.log()` before `process.exit()`.
|
||||
|
||||
### Behavior Changed: WebUSB and WebSerial Blocklist Support
|
||||
|
||||
[WebUSB](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API) and [Web Serial](https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API) now support the [WebUSB Blocklist](https://wicg.github.io/webusb/#blocklist) and [Web Serial Blocklist](https://wicg.github.io/serial/#blocklist) used by Chromium and outlined in their respective specifications.
|
||||
@@ -141,7 +151,7 @@ On Linux, the required portal version for file dialogs has been reverted
|
||||
to 3 from 4. Using the `defaultPath` option of the Dialog API is not
|
||||
supported when using portal file chooser dialogs unless the portal
|
||||
backend is version 4 or higher. The `--xdg-portal-required-version`
|
||||
[command-line switch](/api/command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
[command-line switch](api/command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
can be used to force a required version for your application.
|
||||
See [#44426](https://github.com/electron/electron/pull/44426) for more details.
|
||||
|
||||
|
||||
@@ -155,7 +155,8 @@ $ gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
|
||||
$ gn gen out/Release --args="import(\`"//electron/build/args/release.gn\`")"
|
||||
```
|
||||
|
||||
**Note:** This will generate a `out/Testing` or `out/Release` build directory under `src/` with the testing or release build depending upon the configuration passed above. You can replace `Testing|Release` with another names, but it should be a subdirectory of `out`.
|
||||
> [!NOTE]
|
||||
> This will generate a `out/Testing` or `out/Release` build directory under `src/` with the testing or release build depending upon the configuration passed above. You can replace `Testing|Release` with another names, but it should be a subdirectory of `out`.
|
||||
|
||||
Also you shouldn't have to run `gn gen` again—if you want to change the build arguments, you can run `gn args out/Testing` to bring up an editor. To see the list of available build configuration options, run `gn args out/Testing --list`.
|
||||
|
||||
|
||||
@@ -39,8 +39,9 @@ Building Electron is done entirely with command-line scripts and cannot be done
|
||||
with Visual Studio. You can develop Electron with any editor but support for
|
||||
building with Visual Studio will come in the future.
|
||||
|
||||
**Note:** Even though Visual Studio is not used for building, it's still
|
||||
**required** because we need the build toolchains it provides.
|
||||
> [!NOTE]
|
||||
> Even though Visual Studio is not used for building, it's still
|
||||
> **required** because we need the build toolchains it provides.
|
||||
|
||||
## Exclude source tree from Windows Security
|
||||
|
||||
|
||||
@@ -148,7 +148,8 @@ In your [`shell/common/node_bindings.cc`](https://github.com/electron/electron/b
|
||||
V(electron_browser_{api_name})
|
||||
```
|
||||
|
||||
> Note: More technical details on how Node links with Electron can be found on [our blog](https://www.electronjs.org/blog/electron-internals-using-node-as-a-library#link-node-with-electron).
|
||||
> [!NOTE]
|
||||
> More technical details on how Node links with Electron can be found on [our blog](https://www.electronjs.org/blog/electron-internals-using-node-as-a-library#link-node-with-electron).
|
||||
|
||||
## Expose your API to TypeScript
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ $ git commit
|
||||
$ ../../electron/script/git-export-patches -o ../../electron/patches/node
|
||||
```
|
||||
|
||||
> **NOTE**: `git-export-patches` ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.
|
||||
> [!NOTE]
|
||||
> `git-export-patches` ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.
|
||||
|
||||
Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).
|
||||
|
||||
|
||||
@@ -152,6 +152,14 @@ The effect is visible only on (some?) LCD screens. Even if you don't see a diffe
|
||||
|
||||
Notice that just setting the background in the CSS does not have the desired effect.
|
||||
|
||||
## Class inheritance does not work with Electron built-in modules
|
||||
|
||||
Electron classes cannot be subclassed with the [`extends`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends)
|
||||
keyword (also known as class inheritance). This feature was never implemented in Electron due
|
||||
to the added complexity it would add to C++/JavaScript interop in Electron's internals.
|
||||
|
||||
For more information, see [electron/electron#23](https://github.com/electron/electron/issues/23).
|
||||
|
||||
[memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
|
||||
[closures]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
|
||||
[storage]: https://developer.mozilla.org/en-US/docs/Web/API/Storage
|
||||
|
||||
@@ -78,6 +78,8 @@ See the [Mac App Store Guide][].
|
||||
|
||||
## Signing Windows builds
|
||||
|
||||
### Using traditional certificates
|
||||
|
||||
Before you can code sign your application, you need to acquire a code signing
|
||||
certificate. Unlike Apple, Microsoft allows developers to purchase those
|
||||
certificates on the open market. They are usually sold by the same companies
|
||||
@@ -117,13 +119,13 @@ expose configuration options through a `windowsSign` property. You can either us
|
||||
to sign files directly - or use the same `windowsSign` configuration across Electron
|
||||
Forge, [`@electron/packager`][], [`electron-winstaller`][], and [`electron-wix-msi`][].
|
||||
|
||||
### Using Electron Forge
|
||||
#### Using Electron Forge
|
||||
|
||||
Electron Forge is the recommended way to sign your app as well as your `Squirrel.Windows`
|
||||
and `WiX MSI` installers. Detailed instructions on how to configure your application can
|
||||
be found in the [Electron Forge Code Signing Tutorial](https://www.electronforge.io/guides/code-signing/code-signing-windows).
|
||||
|
||||
### Using Electron Packager
|
||||
#### Using Electron Packager
|
||||
|
||||
If you're not using an integrated build pipeline like Forge, you
|
||||
are likely using [`@electron/packager`][], which includes [`@electron/windows-sign`][].
|
||||
@@ -146,7 +148,7 @@ packager({
|
||||
})
|
||||
```
|
||||
|
||||
### Using electron-winstaller (Squirrel.Windows)
|
||||
#### Using electron-winstaller (Squirrel.Windows)
|
||||
|
||||
[`electron-winstaller`][] is a package that can generate Squirrel.Windows installers for your
|
||||
Electron app. This is the tool used under the hood by Electron Forge's
|
||||
@@ -178,7 +180,7 @@ try {
|
||||
|
||||
For full configuration options, check out the [`electron-winstaller`][] repository!
|
||||
|
||||
### Using electron-wix-msi (WiX MSI)
|
||||
#### Using electron-wix-msi (WiX MSI)
|
||||
|
||||
[`electron-wix-msi`][] is a package that can generate MSI installers for your
|
||||
Electron app. This is the tool used under the hood by Electron Forge's [MSI Maker][maker-msi].
|
||||
@@ -221,11 +223,32 @@ await msiCreator.compile()
|
||||
|
||||
For full configuration options, check out the [`electron-wix-msi`][] repository!
|
||||
|
||||
### Using Electron Builder
|
||||
#### Using Electron Builder
|
||||
|
||||
Electron Builder comes with a custom solution for signing your application. You
|
||||
can find [its documentation here](https://www.electron.build/code-signing).
|
||||
|
||||
### Using Azure Trusted Signing
|
||||
|
||||
[Azure Trusted Signing][] is Microsoft's modern cloud-based alternative to EV certificates.
|
||||
It is the cheapest option for code signing on Windows, and it gets rid of SmartScreen warnings.
|
||||
|
||||
As of May 2025, Azure Trusted Signing is [available][trusted-signing-availability] to US and
|
||||
Canada-based organizations with 3+ years of verifiable business history. Microsoft is looking
|
||||
to make the program more widely available. If you're reading this at a later point, it could
|
||||
make sense to check if the eligibility criteria have changed.
|
||||
|
||||
#### Using Electron Forge
|
||||
|
||||
Electron Forge is the recommended way to sign your app as well as your `Squirrel.Windows`
|
||||
and `WiX MSI` installers. Instructions for Azure Trusted Signing can be found
|
||||
[here][forge-trusted-signing].
|
||||
|
||||
#### Using Electron Builder
|
||||
|
||||
The Electron Builder documentation for Azure Trusted Signing can be found
|
||||
[here][builder-trusted-signing].
|
||||
|
||||
### Signing Windows Store applications
|
||||
|
||||
See the [Windows Store Guide][].
|
||||
@@ -243,3 +266,7 @@ See the [Windows Store Guide][].
|
||||
[windows store guide]: ./windows-store-guide.md
|
||||
[maker-squirrel]: https://www.electronforge.io/config/makers/squirrel.windows
|
||||
[maker-msi]: https://www.electronforge.io/config/makers/wix-msi
|
||||
[azure trusted signing]: https://azure.microsoft.com/en-us/products/trusted-signing
|
||||
[trusted-signing-availability]: https://techcommunity.microsoft.com/blog/microsoft-security-blog/trusted-signing-public-preview-update/4399713
|
||||
[forge-trusted-signing]: https://www.electronforge.io/guides/code-signing/code-signing-windows#using-azure-trusted-signing
|
||||
[builder-trusted-signing]: https://www.electron.build/code-signing-win#using-azure-trusted-signing-beta
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Debugging in VSCode
|
||||
|
||||
This guide goes over how to set up VSCode debugging for both your own Electron project as well as the native Electron codebase.
|
||||
This guide goes over how to set up VSCode debugging for both your own Electron
|
||||
project as well as the native Electron codebase.
|
||||
|
||||
## Debugging your Electron app
|
||||
|
||||
@@ -9,8 +10,8 @@ This guide goes over how to set up VSCode debugging for both your own Electron p
|
||||
#### 1. Open an Electron project in VSCode.
|
||||
|
||||
```sh
|
||||
$ git clone git@github.com:electron/electron-quick-start.git
|
||||
$ code electron-quick-start
|
||||
$ npx create-electron-app@latest my-app
|
||||
$ code my-app
|
||||
```
|
||||
|
||||
#### 2. Add a file `.vscode/launch.json` with the following configuration:
|
||||
@@ -37,23 +38,27 @@ $ code electron-quick-start
|
||||
|
||||
#### 3. Debugging
|
||||
|
||||
Set some breakpoints in `main.js`, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging). You should be able to hit the breakpoints.
|
||||
|
||||
Here is a pre-configured project that you can download and directly debug in VSCode: https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start
|
||||
Set some breakpoints in `main.js`, and start debugging in the
|
||||
[Debug View](https://code.visualstudio.com/docs/editor/debugging). You should
|
||||
be able to hit the breakpoints.
|
||||
|
||||
## Debugging the Electron codebase
|
||||
|
||||
If you want to build Electron from source and modify the native Electron codebase, this section will help you in testing your modifications.
|
||||
If you want to build Electron from source and modify the native Electron codebase,
|
||||
this section will help you in testing your modifications.
|
||||
|
||||
For those unsure where to acquire this code or how to build it, [Electron's Build Tools](https://github.com/electron/build-tools) automates and explains most of this process. If you wish to manually set up the environment, you can instead use these [build instructions](../development/build-instructions-gn.md).
|
||||
For those unsure where to acquire this code or how to build it,
|
||||
[Electron's Build Tools](https://github.com/electron/build-tools) automates and
|
||||
explains most of this process. If you wish to manually set up the environment,
|
||||
you can instead use these [build instructions](../development/build-instructions-gn.md).
|
||||
|
||||
### Windows (C++)
|
||||
|
||||
#### 1. Open an Electron project in VSCode.
|
||||
|
||||
```sh
|
||||
$ git clone git@github.com:electron/electron-quick-start.git
|
||||
$ code electron-quick-start
|
||||
$ npx create-electron-app@latest my-app
|
||||
$ code my-app
|
||||
```
|
||||
|
||||
#### 2. Add a file `.vscode/launch.json` with the following configuration:
|
||||
@@ -86,14 +91,22 @@ $ code electron-quick-start
|
||||
|
||||
**Configuration Notes**
|
||||
|
||||
* `cppvsdbg` requires the [built-in C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) be enabled.
|
||||
* `cppvsdbg` requires the
|
||||
[built-in C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
|
||||
be enabled.
|
||||
* `${workspaceFolder}` is the full path to Chromium's `src` directory.
|
||||
* `your-executable-location` will be one of the following depending on a few items:
|
||||
* `Testing`: If you are using the default settings of [Electron's Build-Tools](https://github.com/electron/build-tools) or the default instructions when [building from source](../development/build-instructions-gn.md#building).
|
||||
* `Testing`: If you are using the default settings of
|
||||
[Electron's Build-Tools](https://github.com/electron/build-tools) or the default
|
||||
instructions when [building from source](../development/build-instructions-gn.md#building).
|
||||
* `Release`: If you built a Release build rather than a Testing build.
|
||||
* `your-directory-name`: If you modified this during your build process from the default, this will be whatever you specified.
|
||||
* The `args` array string `"your-electron-project-path"` should be the absolute path to either the directory or `main.js` file of the Electron project you are using for testing. In this example, it should be your path to `electron-quick-start`.
|
||||
* `your-directory-name`: If you modified this during your build process from
|
||||
the default, this will be whatever you specified.
|
||||
* The `args` array string `"your-electron-project-path"` should be the absolute
|
||||
path to either the directory or `main.js` file of the Electron project you are
|
||||
using for testing. In this example, it should be your path to `my-app`.
|
||||
|
||||
#### 3. Debugging
|
||||
|
||||
Set some breakpoints in the .cc files of your choosing in the native Electron C++ code, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging).
|
||||
Set some breakpoints in the .cc files of your choosing in the native Electron C++
|
||||
code, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging).
|
||||
|
||||
@@ -9,10 +9,11 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
|
||||
|
||||
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
|
||||
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
|
||||
| 37.0.0 | 2025-May-01 | 2025-May-28 | 2025-Jun-24 | 2026-Jan-13 | M138 | TBD | ✅ |
|
||||
| 38.0.0 | 2025-Jun-26 | 2025-Aug-06 | 2025-Sep-02 | 2026-Mar-10 | M140 | TBD | ✅ |
|
||||
| 37.0.0 | 2025-May-01 | 2025-May-28 | 2025-Jun-24 | 2026-Jan-13 | M138 | v22.16 | ✅ |
|
||||
| 36.0.0 | 2025-Mar-06 | 2025-Apr-02 | 2025-Apr-29 | 2025-Oct-28 | M136 | v22.14 | ✅ |
|
||||
| 35.0.0 | 2025-Jan-16 | 2025-Feb-05 | 2025-Mar-04 | 2025-Sep-02 | M134 | v22.14 | ✅ |
|
||||
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2025-Jan-14 | 2025-Jun-24 | M132 | v20.18 | ✅ |
|
||||
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2025-Jan-14 | 2025-Jun-24 | M132 | v20.18 | 🚫 |
|
||||
| 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | v20.18 | 🚫 |
|
||||
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | v20.16 | 🚫 |
|
||||
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-14 | M126 | v20.14 | 🚫 |
|
||||
|
||||
@@ -143,7 +143,7 @@ The `electron/electron` repository also enforces squash merging, so you only nee
|
||||
|
||||
## Historical versioning (Electron 1.X)
|
||||
|
||||
Electron versions _< 2.0_ did not conform to the [SemVer](https://semver.org) spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Teams, Skype, VS Code, and GitHub Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.
|
||||
Electron versions _< 2.0_ did not conform to the [SemVer](https://semver.org) spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Teams, VS Code, and GitHub Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.
|
||||
|
||||
Here is an example of the 1.x strategy:
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ The nodeCliInspect fuse toggles whether the `--inspect`, `--inspect-brk`, etc. f
|
||||
|
||||
**@electron/fuses:** `FuseV1Options.EnableEmbeddedAsarIntegrityValidation`
|
||||
|
||||
The embeddedAsarIntegrityValidation fuse toggles an experimental feature on macOS that validates the content of the `app.asar` file when it is loaded. This feature is designed to have a minimal performance impact but may marginally slow down file reads from inside the `app.asar` archive.
|
||||
The embeddedAsarIntegrityValidation fuse toggles an experimental feature on macOS and Windows that validates the content of the `app.asar` file when it is loaded. This feature is designed to have a minimal performance impact but may marginally slow down file reads from inside the `app.asar` archive.
|
||||
|
||||
For more information on how to use asar integrity validation please read the [Asar Integrity](asar-integrity.md) documentation.
|
||||
|
||||
|
||||
@@ -133,9 +133,10 @@ function handleKeyPress (event) {
|
||||
window.addEventListener('keyup', handleKeyPress, true)
|
||||
```
|
||||
|
||||
> Note: the third parameter `true` indicates that the listener will always receive
|
||||
key presses before other listeners so they can't have `stopPropagation()`
|
||||
called on them.
|
||||
> [!NOTE]
|
||||
> The third parameter `true` indicates that the listener will always receive
|
||||
> key presses before other listeners so they can't have `stopPropagation()`
|
||||
> called on them.
|
||||
|
||||
#### Intercepting events in the main process
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ const win = new BrowserWindow({
|
||||
The `nodeIntegrationInWorker` can be used independent of `nodeIntegration`, but
|
||||
`sandbox` must not be set to `true`.
|
||||
|
||||
**Note:** This option is not available in [`SharedWorker`s](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker) or [`Service Worker`s](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker) owing to incompatibilities in sandboxing policies.
|
||||
> [!NOTE]
|
||||
> This option is not available in [`SharedWorker`s](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker) or [`Service Worker`s](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker) owing to incompatibilities in sandboxing policies.
|
||||
|
||||
## Available APIs
|
||||
|
||||
|
||||
1638
docs/tutorial/native-code-and-electron-cpp-linux.md
Normal file
1638
docs/tutorial/native-code-and-electron-cpp-linux.md
Normal file
File diff suppressed because it is too large
Load Diff
1175
docs/tutorial/native-code-and-electron-swift-macos.md
Normal file
1175
docs/tutorial/native-code-and-electron-swift-macos.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -83,4 +83,5 @@ After launching the Electron application, you should see the notification:
|
||||
|
||||

|
||||
|
||||
> Note: If you need to communicate the connection status to the main process, use the [IPC renderer](../api/ipc-renderer.md) API.
|
||||
> [!NOTE]
|
||||
> If you need to communicate the connection status to the main process, use the [IPC renderer](../api/ipc-renderer.md) API.
|
||||
|
||||
@@ -64,7 +64,8 @@ const contents = win.webContents
|
||||
console.log(contents)
|
||||
```
|
||||
|
||||
> Note: A renderer process is also created for [web embeds][web-embed] such as the
|
||||
> [!NOTE]
|
||||
> A renderer process is also created for [web embeds][web-embed] such as the
|
||||
> `BrowserView` module. The `webContents` object is also accessible for embedded
|
||||
> web content.
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@ dependency, you should be able to access the REPL with the following command:
|
||||
./node_modules/.bin/electron --interactive
|
||||
```
|
||||
|
||||
**Note:** `electron --interactive` is not available on Windows
|
||||
(see [electron/electron#5776](https://github.com/electron/electron/pull/5776) for more details).
|
||||
> [!NOTE]
|
||||
> `electron --interactive` is not available on Windows
|
||||
> (see [electron/electron#5776](https://github.com/electron/electron/pull/5776) for more details).
|
||||
|
||||
## Renderer process
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ for any Snapcraft environment, including the Ubuntu Software Center.
|
||||
|
||||
## Background and Requirements
|
||||
|
||||
Together with the broader Linux community, Canonical aims to fix many of the
|
||||
common software installation problems with the [`snapcraft`](https://snapcraft.io/)
|
||||
Together with the broader Linux community, Canonical aims to address common
|
||||
software installation issues through the [`snapcraft`](https://snapcraft.io/)
|
||||
project. Snaps are containerized software packages that include required
|
||||
dependencies, auto-update, and work on all major Linux distributions without
|
||||
system modification.
|
||||
@@ -83,7 +83,14 @@ snap(options)
|
||||
|
||||
### Step 1: Create Sample Snapcraft Project
|
||||
|
||||
Create your project directory and add the following to `snap/snapcraft.yaml`:
|
||||
```sh
|
||||
$ npx create-electron-app@latest my-app
|
||||
```
|
||||
|
||||
### Step 2: Create Sample Snapcraft Project
|
||||
|
||||
Create a `snap` directory in your project root and add the following to
|
||||
`snap/snapcraft.yaml`:
|
||||
|
||||
```yaml
|
||||
name: electron-packager-hello-world
|
||||
@@ -97,7 +104,7 @@ grade: stable
|
||||
|
||||
apps:
|
||||
electron-packager-hello-world:
|
||||
command: electron-quick-start/electron-quick-start --no-sandbox
|
||||
command: my-app/my-app --no-sandbox
|
||||
extensions: [gnome]
|
||||
plugs:
|
||||
- browser-support
|
||||
@@ -109,13 +116,13 @@ apps:
|
||||
TMPDIR: $XDG_RUNTIME_DIR
|
||||
|
||||
parts:
|
||||
electron-quick-start:
|
||||
my-app:
|
||||
plugin: nil
|
||||
source: https://github.com/electron/electron-quick-start.git
|
||||
source: .
|
||||
override-build: |
|
||||
npm install electron @electron/packager
|
||||
npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true
|
||||
cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start
|
||||
cp -rv ./my-app-linux-* $SNAPCRAFT_PART_INSTALL/my-app
|
||||
build-snaps:
|
||||
- node/14/stable
|
||||
build-packages:
|
||||
@@ -125,12 +132,10 @@ parts:
|
||||
- libnspr4
|
||||
```
|
||||
|
||||
If you want to apply this example to an existing project:
|
||||
If you want to apply this example to an existing project, replace all instances
|
||||
of `my-app` with your project's name.
|
||||
|
||||
- Replace `source: https://github.com/electron/electron-quick-start.git` with `source: .`.
|
||||
- Replace all instances of `electron-quick-start` with your project's name.
|
||||
|
||||
### Step 2: Build the snap
|
||||
### Step 3: Build the snap
|
||||
|
||||
```sh
|
||||
$ snapcraft
|
||||
@@ -139,13 +144,13 @@ $ snapcraft
|
||||
Snapped electron-packager-hello-world_0.1_amd64.snap
|
||||
```
|
||||
|
||||
### Step 3: Install the snap
|
||||
### Step 4: Install the snap
|
||||
|
||||
```sh
|
||||
sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous
|
||||
```
|
||||
|
||||
### Step 4: Run the snap
|
||||
### Step 5: Run the snap
|
||||
|
||||
```sh
|
||||
electron-packager-hello-world
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 'Prerequisites'
|
||||
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
|
||||
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron.'
|
||||
slug: tutorial-prerequisites
|
||||
hide_title: false
|
||||
---
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 'Building your First App'
|
||||
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
|
||||
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron.'
|
||||
slug: tutorial-first-app
|
||||
hide_title: false
|
||||
---
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 'Using Preload Scripts'
|
||||
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.'
|
||||
description: 'This guide will step you through the process of creating a barebones Hello World app in Electron.'
|
||||
slug: tutorial-preload
|
||||
hide_title: false
|
||||
---
|
||||
|
||||
@@ -19,12 +19,12 @@ and only allow the capabilities you want to support.
|
||||
|
||||
### WebViews
|
||||
|
||||
> Important Note:
|
||||
[we do not recommend you to use WebViews](../api/webview-tag.md#warning),
|
||||
as this tag undergoes dramatic architectural changes that may affect stability
|
||||
of your application. Consider switching to alternatives, like `iframe` and
|
||||
Electron's [`WebContentsView`](../api/web-contents-view.md), or an architecture
|
||||
that avoids embedded content by design.
|
||||
> [!IMPORTANT]
|
||||
> [We do not recommend you to use WebViews](../api/webview-tag.md#warning),
|
||||
> as this tag undergoes dramatic architectural changes that may affect stability
|
||||
> of your application. Consider switching to alternatives, like `iframe` and
|
||||
> Electron's [`WebContentsView`](../api/web-contents-view.md), or an architecture
|
||||
> that avoids embedded content by design.
|
||||
|
||||
[WebViews](../api/webview-tag.md) are based on Chromium's WebViews and are not
|
||||
explicitly supported by Electron. We do not guarantee that the WebView API will
|
||||
|
||||
@@ -44,7 +44,7 @@ Electron combines Chromium, Node.js, and the ability to write custom native code
|
||||
|
||||
### Enterprise-grade
|
||||
|
||||
Electron is reliable, secure, stable, and mature. It is the premier choice for companies building their flagship product. We have a list of some of those companies on our homepage, but just among chat apps, Slack, Discord, and Skype are built with Electron. Among AI applications, both OpenAI’s ChatGPT and Anthropic’s Claude use Electron. Visual Studio Code, Loom, Canva, Notion, Docker, and countless other leading developers of software bet on Electron.
|
||||
Electron is reliable, secure, stable, and mature. It is the premier choice for companies building their flagship product. We have a list of some of those companies on our homepage, but just among chat apps, Slack, Discord, and Signal are built with Electron. Among AI applications, both OpenAI’s ChatGPT and Anthropic’s Claude use Electron. Visual Studio Code, Loom, Canva, Notion, Docker, and countless other leading developers of software bet on Electron.
|
||||
|
||||
We did make it a priority to make Electron easy to work with and a delight for developers. That’s likely the main reason why Electron became as popular as it is today — but what keeps Electron alive and thriving is the maintainer’s focus on making Electron as stable, secure, performant, and capable of mission-critical use cases for end users as possible. We’re building an Electron that is ready to be used in scenarios where unfixable bugs, unpatched security holes, and outages of any kind are worst-case scenarios.
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ auto_filenames = {
|
||||
"docs/api/extensions-api.md",
|
||||
"docs/api/extensions.md",
|
||||
"docs/api/global-shortcut.md",
|
||||
"docs/api/image-view.md",
|
||||
"docs/api/in-app-purchase.md",
|
||||
"docs/api/incoming-message.md",
|
||||
"docs/api/ipc-main-service-worker.md",
|
||||
|
||||
@@ -35,6 +35,7 @@ filenames = {
|
||||
"shell/browser/relauncher_linux.cc",
|
||||
"shell/browser/ui/electron_desktop_window_tree_host_linux.cc",
|
||||
"shell/browser/ui/file_dialog_linux.cc",
|
||||
"shell/browser/ui/file_dialog_linux_portal.cc",
|
||||
"shell/browser/ui/gtk/menu_gtk.cc",
|
||||
"shell/browser/ui/gtk/menu_gtk.h",
|
||||
"shell/browser/ui/gtk/menu_util.cc",
|
||||
@@ -478,6 +479,7 @@ filenames = {
|
||||
"shell/browser/osr/osr_web_contents_view.h",
|
||||
"shell/browser/plugins/plugin_utils.cc",
|
||||
"shell/browser/plugins/plugin_utils.h",
|
||||
"shell/browser/preload_script.cc",
|
||||
"shell/browser/preload_script.h",
|
||||
"shell/browser/protocol_registry.cc",
|
||||
"shell/browser/protocol_registry.h",
|
||||
|
||||
@@ -1421,7 +1421,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__type_traits/is_member_pointer.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_convertible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_destructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_null_pointer.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_object.h",
|
||||
|
||||
@@ -71,7 +71,7 @@ const MenuItem = function (this: any, options: any) {
|
||||
};
|
||||
};
|
||||
|
||||
MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio'];
|
||||
MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio', 'header', 'palette'];
|
||||
|
||||
MenuItem.prototype.getDefaultRoleAccelerator = function () {
|
||||
return roles.getDefaultAccelerator(this.role);
|
||||
|
||||
@@ -143,6 +143,9 @@ Menu.prototype.insert = function (pos, item) {
|
||||
if (item.toolTip) this.setToolTip(pos, item.toolTip);
|
||||
if (item.icon) this.setIcon(pos, item.icon);
|
||||
if (item.role) this.setRole(pos, item.role);
|
||||
if (item.type === 'palette' || item.type === 'header') {
|
||||
this.setCustomType(pos, item.type);
|
||||
}
|
||||
|
||||
// Make menu accessible to items.
|
||||
item.overrideReadOnlyProperty('menu', this);
|
||||
@@ -264,9 +267,11 @@ function removeExtraSeparators (items: (MenuItemConstructorOptions | MenuItem)[]
|
||||
function insertItemByType (this: MenuType, item: MenuItem, pos: number) {
|
||||
const types = {
|
||||
normal: () => this.insertItem(pos, item.commandId, item.label),
|
||||
header: () => this.insertItem(pos, item.commandId, item.label),
|
||||
checkbox: () => this.insertCheckItem(pos, item.commandId, item.label),
|
||||
separator: () => this.insertSeparator(pos),
|
||||
submenu: () => this.insertSubMenu(pos, item.commandId, item.label, item.submenu),
|
||||
palette: () => this.insertSubMenu(pos, item.commandId, item.label, item.submenu),
|
||||
radio: () => {
|
||||
// Grouping radio menu items
|
||||
item.overrideReadOnlyProperty('groupId', generateGroupId(this.items, pos));
|
||||
|
||||
@@ -26,7 +26,12 @@ const keysOfTypeNumberCompileTimeCheck: { [K in IntegerBrowserWindowOptionKeys]
|
||||
};
|
||||
// Note `top` / `left` are special cases from the browser which we later convert
|
||||
// to y / x.
|
||||
const keysOfTypeNumber = new Set(['top', 'left', ...Object.keys(keysOfTypeNumberCompileTimeCheck)]);
|
||||
// NOTE(@mlaurencin) `innerWidth` / `innerHeight` are also special cases. The spec
|
||||
// states that `width` and `height` represent the window content size and are equivalent
|
||||
// to `innerWidth` / `innerHeight`. However, our implementation currently incorrectly maps
|
||||
// `width` and `height` to `outerWidth` and `outerHeight`, or the size of the window
|
||||
// with all border and related window chrome.
|
||||
const keysOfTypeNumber = new Set(['top', 'left', 'innerWidth', 'innerHeight', ...Object.keys(keysOfTypeNumberCompileTimeCheck)]);
|
||||
|
||||
/**
|
||||
* Note that we only allow "0" and "1" boolean conversion when the type is known
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user