Category: Electron Api

  • View

    Create and layout native views. Process: Main This module cannot be used until the ready event of the app module is emitted. Class: View​ A basic native view. Process: Main View is an EventEmitter. new View()​ Creates a new View. Instance Events​ Objects created with new View emit the following events: Event: ‘bounds-changed’​ Emitted when the view’s bounds have changed in response to being laid out.…

  • WebFrameMain

    Control web pages and iframes. Process: Main The webFrameMain module can be used to lookup frames across existing WebContents instances. Navigation events are the common use case. You can also access frames of existing pages by using the mainFrame property of WebContents. Methods​ These methods can be accessed from the webFrameMain module: webFrameMain.fromId(processId, routingId)​ Returns WebFrameMain | undefined – A frame with the given process and routing…

  • WebContentsView

    A View that displays a WebContents. Process: Main This module cannot be used until the ready event of the app module is emitted. Class: WebContentsView extends View​ A View that displays a WebContents. Process: Main WebContentsView inherits from View. WebContentsView is an EventEmitter. new WebContentsView([options])​ Creates a WebContentsView. Instance Properties​ Objects created with new WebContentsView have the following properties, in addition to those inherited from View: view.webContents Readonly​ A WebContents property containing…

  • WebContents

    Render and control web pages. Process: Main webContents is an EventEmitter. It is responsible for rendering and controlling a web page and is a property of the BrowserWindow object. An example of accessing the webContents object: Navigation Events​ Several events can be used to monitor navigations as they occur within a webContents. Document Navigations​ When a webContents navigates to another page (as opposed to an in-page…

  • UtilityProcess

    utilityProcess creates a child process with Node.js and Message ports enabled. It provides the equivalent of child_process.fork API from Node.js but instead uses Services API from Chromium to launch the child process. Process: Main Methods​ utilityProcess.fork(modulePath[, args][, options])​ Returns UtilityProcess Class: UtilityProcess​ Instances of the UtilityProcess represent the Chromium spawned child process with Node.js integration. UtilityProcess is an EventEmitter. Instance Methods​ child.postMessage(message, [transfer])​ Send a message…

  • Tray

    Class: Tray​ Add icons and context menus to the system’s notification area. Process: Main Tray is an EventEmitter. Platform Considerations Linux MacOS Windows new Tray(image, [guid])​ Creates a new tray icon associated with the image. Instance Events​ The Tray module emits the following events: Event: ‘click’​ Returns: Emitted when the tray icon is clicked. Note that on Linux this event is…

  • TouchBar

    Class: TouchBar​ Create TouchBar layouts for native macOS applications Process: Main new TouchBar(options)​ Creates a new touch bar with the specified items. Use BrowserWindow.setTouchBar to add the TouchBar to a window. Note: The TouchBar API is currently experimental and may change or be removed in future Electron releases. Tip: If you don’t have a MacBook with Touch Bar, you can use Touch Bar…

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