↳ Device States

AirConsole

new AirConsole(opts) → {AirConsoleObject}

Your gateway object to AirConsole. There are getter and setter functions for all properties. Do not access properties of this object directly.
Parameters:
Name Type Description
opts AirConsole~Config Constructor config, see bellow.
Source:
Returns:
The AirConsole object.
Type
AirConsoleObject

Methods

getCustomDeviceState(device_id) → {Object|undefined}

Gets the custom DeviceState of a device.
Parameters:
Name Type Description
device_id number | undefined The device ID of which you want the custom state. Default is this device.
Source:
Returns:
The custom data previously set by the device.
Type
Object | undefined

(abstract) onCustomDeviceStateChange(device_id, custom_data)

Gets called when a device updates it's custom DeviceState by calling setCustomDeviceState or setCustomDeviceStateProperty. Make sure you understand the power of device states:
Parameters:
Name Type Description
device_id number the device ID that changed its custom DeviceState.
custom_data Object The custom DeviceState data value
Source:
See:

(abstract) onDeviceStateChange(device_id, user_data)

Gets called when a device joins/leaves a game session or updates its DeviceState (custom DeviceState, profile pic, nickname, internal state). This is function is also called every time onConnect, onDisconnect or onCustomDeviceStateChange, onDeviceProfileChange is called. It's like their root function.
Parameters:
Name Type Description
device_id number the device_id that changed its DeviceState.
user_data AirConsole~DeviceState the data of that device. If undefined, the device has left.
Source:

setCustomDeviceState(data)

Sets the custom DeviceState of this device.
Parameters:
Name Type Description
data Object The custom data to set.
Source:

setCustomDeviceStateProperty(key, value)

Sets a property in the custom DeviceState of this device.
Parameters:
Name Type Description
key String The property name.
value mixed The property value.
Source:

setImmersiveState(immersiveState)

Sets the immersive state of the AirConsole game based on the provided options.
At least one property is required for the immersive state to be set.
Parameters:
Name Type Description
immersiveState ImmersiveOption The immersive state to send.
Source: