目录

Display

A display connected to the system.

Coordinates and sizes in bounds and workArea are logical pixels. Use resolution for the physical pixel size of the display.

Example 

import { displays } from '@mobrowser/api';

for (const display of displays.all) {
  console.log('Display:', display.name || display.id)
  console.log('Primary:', display.isPrimary)
  console.log('External:', display.isExternal)
  console.log('Bounds:', display.bounds)
  console.log('Work area:', display.workArea)
  console.log('Resolution:', display.resolution)
  console.log('Scale factor:', display.scaleFactor)
}

Properties 

id 

readonly id: number;

The platform display identifier.

name 

readonly name: string;

The display name reported by the platform, or an empty string if it is unavailable.

isPrimary 

readonly isPrimary: boolean;

Whether this display is the current primary display.

isExternal 

readonly isExternal: boolean;

Whether this display is external to the device, rather than a built-in panel.

bounds 

readonly bounds: Rect;

The display bounds in logical pixels.

workArea 

readonly workArea: Rect;

The display work area in logical pixels.

The work area excludes platform UI such as the taskbar, Dock, or menu bar.

resolution 

readonly resolution: Size;

The physical display resolution in pixels.

scaleFactor 

readonly scaleFactor: number;

The positive device scale factor between logical pixels and physical pixels.

1.0 means one logical pixel maps to one physical pixel. 2.0 means one logical pixel maps to two physical pixels on each axis. Values are platform-dependent and may be fractional, for example 1.25 or 1.5.