onScreensChange([callback], remove)

Class: SwingUI.

Description:

Registers, unregisters and retrieves event handler for event emitted by changes to screens on the computer, such as connecting a screen, disconnecting a screen, or changes to screen resolution.

Parameters:

Name Type Default Description

[callback]

function

Function to handle the event, null to remove all handlers, or omit to retrieve an array of handlers.

remove

boolean

false

Removed the callback from this event

Returns:

If called without parameters, an array of registered callbacks is returned; otherwise this instance of SwingUI class is returned.

Type: SwingUI | Array.<function()>

Examples:

Registering screens change event handler:

ui.onScreensChange(e => {console.log(e.screens});

Also See: