Author: tayyaba
-
SystemPreferences
Get system preferences. Process: Main, Utility Events The systemPreferences object emits the following events: Event: ‘accent-color-changed’ Windows Returns: Event: ‘color-changed’ Windows Returns: Methods systemPreferences.isSwipeTrackingFromScrollEventsEnabled() macOS Returns boolean – Whether the Swipe between pages setting is on. systemPreferences.postNotification(event, userInfo[, deliverImmediately]) macOS Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification. systemPreferences.postLocalNotification(event, userInfo) macOS Posts event as native notifications of…
-
Shell
Manage files and URLs using their default applications. Process: Main, Renderer (non-sandboxed only) The shell module provides functions related to desktop integration. An example of opening a URL in the user’s default browser: Note: While the shell module can be used in the renderer process, it will not function in a sandboxed renderer. Methods The shell module has the following methods: shell.showItemInFolder(fullPath) Show the given…
-
ShareMenu
The ShareMenu class creates Share Menu on macOS, which can be used to share information from the current context to apps, social media accounts, and other services. For including the share menu as a submenu of other menus, please use the shareMenu role of MenuItem. Class: ShareMenu Create share menu on macOS. Process: Main new ShareMenu(sharingItem) Creates a new share menu. Instance Methods…
-
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…