Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

The Electron process


May 25, 2021 Electron


Table of contents


The process object process differs from the following in upstream node:

  • process.type String - Process type, which can browser (i.e. main process) or renderer .
  • process.versions['electron'] String - Electron version.
  • process.versions['chrome'] String - Chromium version.
  • process.resourcesPath - JavaScript source code path.
  • process.mas Boolean - Created in the Mac App Store, its value true and elsewhere the value undefined .

Event

Event: 'loaded'

Triggered when Electron has loaded its internal preset script and it is ready to load the main process or render process.

When node is completely shut down, it can be used by preloaded scripts to add (se: removed) a global symbol independent of node that recedes back to the global scope:

// preload.js
var _setImmediate = setImmediate;
var _clearImmediate = clearImmediate;
process.once('loaded', function() {
  global.setImmediate = _setImmediate;
  global.clearImmediate = _clearImmediate;
});

Property

process.noAsar

Setting it true true asar effective in node's built-in module.

Method

process object has the following methods:

process.hang()

Suspend the main thread of the current process.

process.setFdLimit(maxDescriptors) OS X Linux

  • maxDescriptors Integer
Set the file descriptor softly limited maxDescriptors hard limits with os, whether or not it is lower than the current process.