Category: Electron Api

  • Session

    Manage browser sessions, cookies, cache, proxy settings, etc. Process: Main The session module can be used to create new Session objects. You can also access the session of existing pages by using the session property of WebContents, or from the session module. Methods​ The session module has the following methods: session.fromPartition(partition[, options])​ Returns Session – A session instance from partition string. When there is an existing Session with the same partition, it will be returned; otherwise…

  • Screen

    Retrieve information about screen size, displays, cursor position, etc. Process: Main This module cannot be used until the ready event of the app module is emitted. screen is an EventEmitter. 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: DOCS/FIDDLES/SCREEN/FIT-SCREEN (31.4.0)Open in Fiddle…

  • SafeStorage

    Allows access to simple encryption and decryption of strings for storage on the local machine. Process: Main This module adds extra protection to data being stored on disk by using OS-provided cryptography systems. Current security semantics for each platform are outlined below. Note that on Mac, access to the system Keychain is required and these calls…

  • pushNotifications

    Process: Main Register for and receive notifications from remote push notification services For example, when registering for push notifications via Apple push notification services (APNS): Events​ The pushNotification module emits the following events: Event: ‘received-apns-notification’ macOS​ Returns: Emitted when the app receives a remote notification while running. See: https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc Methods​ The pushNotification module has the following methods: pushNotifications.registerForAPNSNotifications() macOS​ Returns Promise<string> Registers the app…

  • protocol

    Register a custom protocol and intercept existing protocol requests. Process: Main An example of implementing a protocol that has the same effect as the file:// protocol: 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​ A protocol is registered to a specific Electron session object. If you don’t specify a session, then…

  • protocol

    Register a custom protocol and intercept existing protocol requests. Process: Main An example of implementing a protocol that has the same effect as the file:// protocol: 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​ A protocol is registered to a specific Electron session object. If you don’t specify a session, then…

  • process

    Extensions to process object. Process: Main, Renderer Electron’s process object is extended from the Node.js process object. It adds the following events, properties, and methods: Sandbox​ In sandboxed renderers the process object contains only a subset of the APIs: Events​ Event: ‘loaded’​ Emitted when Electron has loaded its internal initialization script and is beginning to load the web page or the main script. Properties​…

  • 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…