Electron API



Retrieve information about screen size, displays, cursor position, etc.

API
  1. Building cross platform electron based desktop apps with.NET Core and ASP.NET Core. This package contains the API to access the 'native' electron API.
  2. Note: Electron does not support arbitrary Chrome extensions from the store, and it is a non-goal of the Electron project to be perfectly compatible with Chrome's implementation of Extensions. File Object: Renderer: Use the HTML5 File API to work natively with files on the filesystem. Frameless Window: Main.

You can use a private repository for updates with electron-updater by setting the GHTOKEN environment variable (on user machine) and private option. If GHTOKEN is set, electron-updater will use the GitHub API for updates allowing private repositories to work. Developer API only. See Configuration for user documentation. Electron-builder¶ electron-builder.Arch: enum.build(rawOptions) ⇒ Promise.createTargets(platforms, type, arch) ⇒ Map electron-builder.Arch: enum¶ Kind: enum of electron-builder Properties. ia32. x64. armv7l. arm64.

Process: Main

This module cannot be used until the ready event of the appmodule is emitted.

screen is an EventEmitter.

Note: In the renderer / DevTools, window.screen is a reserved DOMproperty, so writing let { screen } = require('electron') will not work.

An example of creating a window that fills the whole screen:

Another example of creating a window in the external display:

Events

The screen module emits the following events:

Event: 'display-added'

Returns:

  • event Event
  • newDisplayDisplay

Emitted when newDisplay has been added.

Event: 'display-removed'

Returns:

  • event Event
  • oldDisplayDisplay

Emitted when oldDisplay has been removed.

Event: 'display-metrics-changed'

Electron API

Returns:

  • event Event
  • displayDisplay
  • changedMetrics String[]

Emitted when one or more metrics change in a display. The changedMetrics isan array of strings that describe the changes. Possible changes are bounds,workArea, scaleFactor and rotation.

Methods

Electron Api App

The screen module has the following methods:

screen.getCursorScreenPoint()

Returns Point

The current absolute position of the mouse pointer.

screen.getPrimaryDisplay()

RequestElectron API

Electron Api Clipboard

Returns Display - The primary display.

screen.getAllDisplays()

Returns Display[] - An array of displays that are currently available.

screen.getDisplayNearestPoint(point)

  • pointPoint

Returns Display - The display nearest the specified point.

screen.getDisplayMatching(rect)

  • rectRectangle

Returns Display - The display that most closelyintersects the provided bounds.

screen.screenToDipPoint(point)Windows

  • pointPoint

Returns Point

Converts a screen physical point to a screen DIP point.The DPI scale is performed relative to the display containing the physical point.

screen.dipToScreenPoint(point)Windows

  • pointPoint

Returns Point

Converts a screen DIP point to a screen physical point.The DPI scale is performed relative to the display containing the DIP point.

screen.screenToDipRect(window, rect)Windows

  • windowBrowserWindow | null
  • rectRectangle

Electron Api Demo

Returns Rectangle

Converts a screen physical rect to a screen DIP rect.The DPI scale is performed relative to the display nearest to window.If window is null, scaling will be performed to the display nearest to rect.

Electron Api

screen.dipToScreenRect(window, rect)Windows

Electron Api Browserwindow

  • windowBrowserWindow | null
  • rectRectangle

Returns Rectangle

Converts a screen DIP rect to a screen physical rect.The DPI scale is performed relative to the display nearest to window.If window is null, scaling will be performed to the display nearest to rect.





Comments are closed.