Author: tayyaba
-
powerSaveBlocker
Block the system from entering low-power (sleep) mode. Process: Main For example: Methods The powerSaveBlocker module has the following methods: powerSaveBlocker.start(type) 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…
-
powerMonitor
Monitor power state changes. Process: Main Events The powerMonitor module emits the following events: Event: ‘suspend’ Emitted when the system is suspending. Event: ‘resume’ Emitted when system is resuming. Event: ‘on-ac’ macOS Windows Emitted when the system changes to AC power. Event: ‘on-battery’ macOS Windows Emitted when system changes to battery power. Event: ‘thermal-state-change’ macOS Emitted when the thermal state of the system…
-
parentPort
Interface for communication with parent process. Process: Utility parentPort is an EventEmitter. This object is not exported from the ‘electron’ module. It is only available as a property of the process object in the Electron API. Events The parentPort object emits the following events: Event: ‘message’ Returns: Emitted when the process receives a message. Messages received on this port will be queued up…
-
Notification
Create OS desktop notifications Process: Main RENDERER PROCESS NOTIFICATIONS If you want to show notifications from a renderer process you should use the web Notifications API Class: Notification Create OS desktop notifications Process: Main Notification is an EventEmitter. It creates a new Notification with native properties as set by the options. Static Methods The Notification class has the following static methods: Notification.isSupported() Returns boolean – Whether or…
-
NetLog
Logging network events for a session. Process: Main See –log-net-log 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. Methods netLog.startLogging(path[, options]) Returns Promise<void> – resolves when the net log has begun recording. Starts recording network events to path. netLog.stopLogging() Returns Promise<void> – resolves when the net log has been…
-
Net
Issue HTTP/HTTPS requests using Chromium’s native networking library Process: Main, Utility The net module is a client-side API for issuing HTTP(S) requests. It is similar to the HTTP and HTTPS modules of Node.js but uses Chromium’s native networking library instead of the Node.js implementation, offering better support for web proxies. It also supports checking network status. The following is a non-exhaustive list of…
-
NativeTheme
Read and respond to changes in Chromium’s native color theme. Process: Main Events The nativeTheme module emits the following events: Event: ‘updated’ Emitted when something in the underlying NativeTheme has changed. This normally means that either the value of shouldUseDarkColors, shouldUseHighContrastColors or shouldUseInvertedColorScheme has changed. You will have to check them to determine which one has changed. Properties The nativeTheme module has the following properties:…
-
NativeImage
Create tray, dock, and application icons using PNG or JPG files. Process: Main, Renderer The nativeImage module provides a unified interface for manipulating system images. These can be handy if you want to provide multiple scaled versions of the same icon or take advantage of macOS template images. Electron APIs that take image files accept either file paths or NativeImage instances. An…
-
MessagePortMain
MessagePortMain is the main-process-side equivalent of the DOM MessagePort object. It behaves similarly to the DOM version, with the exception that it uses the Node.js EventEmitter event system, instead of the DOM EventTarget system. This means you should use port.on(‘message’, …) to listen for events, instead of port.onmessage = … or port.addEventListener(‘message’, …) See the Channel Messaging API documentation for more information on using channel messaging. MessagePortMain is an EventEmitter. Class:…
-
MessageChannelMain
MessageChannelMain is the main-process-side equivalent of the DOM MessageChannel object. Its singular function is to create a pair of connected MessagePortMain objects. See the Channel Messaging API documentation for more information on using channel messaging. Class: MessageChannelMain Channel interface for channel messaging in the main process. Process: Main Example: Instance Properties channel.port1 A MessagePortMain property. channel.port2 A MessagePortMain property.