Displays

The Displays object provides monitor information to the app. Also, see Monitor object for accessing properties for each display.

Refer to the Developing hub apps for dual monitors/displays article for the sample app.

Example:


window.dapi.displays.subscribe(_listenMonitorChangeEvent.bind(this));

function _listenMonitorChangeEvent() {
    var monitorCount   = window.dapi.displays.monitorCount;
    var monitor1Width  = window.dapi.displays.monitor1.width;
    var monitor1Height = window.dapi.displays.monitor1.height;
    var monitor2Width  = window.dapi.displays.monitor2.width;
    var monitor2Height = window.dapi.displays.monitor2.height;

 var displayProps = {
     monitorCount:   monitorCount,
     monitor1Width:  monitor1Width,
     monitor1Height: monitor1Height,
     monitor2Width:  monitor2Width,
     monitor2Height: monitor2Height
 }

   _processUI(displayProps)
}

Member Summary

Public Members

Monitor 1 information.

Monitor 2 information.

Monitor Count.

Method Summary

Public Methods

subscribe(callback: function())

Subscribe the callback for change notifications.

unsubscribe(callback: function())

Unsubscribe the callback.

Public Members

public monitor1: Monitor source

Monitor 1 information.

Example:

var monitor1Width  = window.dapi.displays.monitor1.width;
var monitor1Height = window.dapi.displays.monitor1.height;

public monitor2: Monitor source

Monitor 2 information.

Example:

var monitor2Width  = window.dapi.displays.monitor2.width;
var monitor2Height = window.dapi.displays.monitor2.height;

public monitorCount: number source

Monitor Count. Represents whether 1 or 2 monitors are connected to the Dolby Voice Hub.

Example:

var monitorCount = window.dapi.displays.monitorCount;

Public Methods

public subscribe(callback: function()) source

Subscribe the callback for change notifications. If any of the Displays properties change, the callback will be executed.

Params:

NameTypeAttributeDescription
callback function()

The callback function

Example:

window.dapi.displays.subscribe(_listenMonitorChangeEvent.bind(this));

public unsubscribe(callback: function()) source

Unsubscribe the callback.

Params:

NameTypeAttributeDescription
callback function()

The callback function

Example:


window.dapi.displays.unsubscribe(_listenMonitorChangeEvent);