Category: Electron Api

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

  • Menu

    Class: Menu​ Create native application menus and context menus. Process: Main new Menu()​ Creates a new menu. Static Methods​ The Menu class has the following static methods: Menu.setApplicationMenu(menu)​ Sets menu as the application menu on macOS. On Windows and Linux, the menu will be set as each window’s top menu. Also on Windows and Linux, you can use a & in the top-level item…

  • IpcMain

    Communicate asynchronously from the main process to renderer processes. Process: Main The ipcMain module is an Event Emitter. When used in the main process, it handles asynchronous and synchronous messages sent from a renderer process (web page). Messages sent from a renderer will be emitted to this module. For usage examples, check out the IPC tutorial. Sending messages​ It is…

  • InAppPurchase

    In-app purchases on Mac App Store. Process: Main Events​ The inAppPurchase module emits the following events: Event: ‘transactions-updated’​ Emitted when one or more transactions have been updated. Returns: Methods​ The inAppPurchase module has the following methods: inAppPurchase.purchaseProduct(productID[, opts])​ Returns Promise<boolean> – Returns true if the product is valid and added to the payment queue. You should listen for the transactions-updated event as soon as possible and…