Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
electron
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ExcellentOSS
electron
Commits
260678bd
Unverified
Commit
260678bd
authored
2 years ago
by
Robo
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
docs: add utility process info to tutorial docs (#36074)
parent
02ad8fcd
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/tutorial/process-model.md
+17
-0
17 additions, 0 deletions
docs/tutorial/process-model.md
with
17 additions
and
0 deletions
docs/tutorial/process-model.md
+
17
−
0
View file @
260678bd
...
...
@@ -214,8 +214,25 @@ This feature is incredibly useful for two main purposes:
URL, you can add custom properties onto the renderer's
`window`
global that can
be used for desktop-only logic on the web client's side.
## The utility process
Each Electron app can spawn multiple child processes from the main process using
the
[
UtilityProcess
][]
API. The utility process runs in a Node.js environment,
meaning it has the ability to
`require`
modules and use all of Node.js APIs.
The utility process can be used to host for example: untrusted services,
CPU intensive tasks or crash prone components which would have previously
been hosted in the main process or process spawned with Node.js
[
`child_process.fork`
][]
API.
The primary difference between the utility process and process spawned by Node.js
child_process module is that the utility process can establish a communication
channel with a renderer process using
[
`MessagePort`
][]
s. An Electron app can
always prefer the
[
UtilityProcess
][]
API over Node.js
[
`child_process.fork`
][]
API when
there is need to fork a child process from the main process.
[
window-mdn
]:
https://developer.mozilla.org/en-US/docs/Web/API/Window
[
`MessagePort`
]:
https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
[
`child_process.fork`
]:
https://nodejs.org/dist/latest-v16.x/docs/api/child_process.html#child_processforkmodulepath-args-options
[
context-isolation
]:
./context-isolation.md
[
context-bridge
]:
../api/context-bridge.md
[
ipcrenderer
]:
../api/ipc-renderer.md
[
UtilityProcess
]:
../api/utility-process.md
[
tutorial
]:
./tutorial-1-prerequisites.md
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment