Author: tayyaba
-
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…
-
GlobalShortcut
Detect keyboard events when the application does not have keyboard focus. Process: Main The globalShortcut module can register/unregister a global keyboard shortcut with the operating system so that you can customize the operations for various shortcuts. Note: The shortcut is global; it will work even if the app does not have the keyboard focus. This module cannot be used…
-
Dialog
Display native system dialogs for opening and saving files, alerting, etc. Process: Main An example of showing a dialog to select multiple files: Methods The dialog module has the following methods: dialog.showOpenDialogSync([browserWindow, ]options) Returns string[] | undefined, the file paths chosen by the user; if the dialog is cancelled it returns undefined. The browserWindow argument allows the dialog to attach itself to…
-
DesktopCapturer
Access information about media sources that can be used to capture audio and video from the desktop using the navigator.mediaDevices.getUserMedia API. Process: Main The following example shows how to capture video from a desktop window whose title is Electron: See navigator.mediaDevices.getDisplayMedia for more information. Note: navigator.mediaDevices.getDisplayMedia does not permit the use of deviceId for selection of a source – see specification. Methods The desktopCapturer module has the following…
-
CrashReporter
Submit crash reports to a remote server. Process: Main, Renderer The following is an example of setting up Electron to automatically submit crash reports to a remote server: For setting up a server to accept and process crash reports, you can use following projects: Note: Electron uses Crashpad, not Breakpad, to collect and upload crashes, but for the…
-
ContentTracing
Collect tracing data from Chromium to find performance bottlenecks and slow operations. Process: Main This module does not include a web interface. To view recorded traces, use trace viewer, available at chrome://tracing in Chrome. Note: You should not use this module until the ready event of the app module is emitted. Methods The contentTracing module has the following methods: contentTracing.getCategories() Returns Promise<string[]> – resolves with an…
-
Clipboard
Perform copy and paste operations on the system clipboard. Process: Main, Renderer (non-sandboxed only) On Linux, there is also a selection clipboard. To manipulate it you need to pass selection to each method: Methods The clipboard module has the following methods: Note: Experimental APIs are marked as such and could be removed in future. clipboard.readText([type]) Returns string – The content in the clipboard as plain text. clipboard.writeText(text[,…
-
BrowserWindow
Create and control browser windows. Process: Main This module cannot be used until the ready event of the app module is emitted. Window customization The BrowserWindow class exposes various ways to modify the look and behavior of your app’s windows. For more details, see the Window Customization tutorial. Showing the window gracefully When loading a page in the window directly, users may see the…