Host · class

BrowserDisplay

Explained in Display and the host.

class BrowserDisplay implements DisplayControl
import { BrowserDisplay } from '@driftengine/core';

Constructor

new

constructor(element: HTMLElement)
ParameterTypeDescription
elementHTMLElement

Properties

NameTypeDescription
refreshHzreadonlynumber | nullNull always, here: no browser API reports this.
More

Measuring it from frame intervals is possible and is deliberately not done — the answer would be wrong on exactly the machines that care, where the compositor is capping a display that runs faster. A shell asks the operating system and knows.

Methods

isFullscreen

isFullscreen(): boolean

mode

mode(): WindowMode

setMode

setMode(mode: WindowMode): Promise<boolean>
ParameterTypeDescription
modeWindowMode

setFullscreen

setFullscreen(on: boolean): Promise<void>
ParameterTypeDescription
onboolean

size

size(): { readonly width: number; readonly height: number; }

canSetSize

canSetSize(): boolean

Always false, and it touches nothing to say so.

More

The same answer setSize gives and for the same reason, which is why they are written next to each other: a browser cannot resize a window it did not open, so a settings screen greys the control rather than offering one that quietly does nothing.

setSize

setSize(_width: number, _height: number): Promise<boolean>

Always false.

ParameterTypeDescription
_widthnumber
_heightnumber
More

window.resizeTo is refused for anything but a window the script opened itself, so a browser genuinely cannot do this. Saying so lets a settings screen disable the control; returning true and doing nothing would leave a resolution list that appears to work.

displays

displays(): readonly DisplayInfo[]

The one screen this browser can see.

More

One entry rather than none: the browser does know the screen it is on, and an empty list would make a settings screen report no displays on a machine that plainly has one. What it does not know is the refresh rate or the names and positions of any other display, and it says so by leaving them null and absent respectively.