System
Defined in: system/system.ts:68
The System class provides you methods to fetch audio devices to manipulate the application’s audio settings. It also allows you to fetch games, microphone devices and camera devices to add to scenes. Finally, some system-level functionality such as cursor position is exposed.
Basic Usage
Section titled “Basic Usage”var XJS = require('xjs');var System = XJS.System;
System.getCameraDevices().then(function(cameras) { window.cameras = cameras;});Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new System():
System
Returns
Section titled “Returns”System
Methods
Section titled “Methods”getAudioDevices()
Section titled “getAudioDevices()”
staticgetAudioDevices(dataflow?,state?):Promise<AudioDevice[]>
Defined in: system/system.ts:87
return: Promise<AudioDevice[]>
Gets audio devices, both input and output See also: #system/AudioDevice System/AudioDevice
System.getAudioDevices( XML.AudioDeviceDataflow.ALL, XML.AudioDeviceState.ACTIVE).then(function(devices) { // devices is an array of AudioDevice object window.audios = devices;});Parameters
Section titled “Parameters”dataflow?
Section titled “dataflow?”AudioDeviceDataflow = AudioDeviceDataflow.ALL
state?
Section titled “state?”AudioDeviceState = AudioDeviceState.ACTIVE
Returns
Section titled “Returns”Promise<AudioDevice[]>
getAvailableScreens()
Section titled “getAvailableScreens()”
staticgetAvailableScreens():Promise<any>
Defined in: system/system.ts:239
return: Promise<Screen[]>
Gets all available screen/windows that may be added to the stage See also: #system/Screen System/Screen
System.getAvailableScreens().then(function(screens) { screens[0].addToScene(); // add first screen to stage});Returns
Section titled “Returns”Promise<any>
getCameraDevices()
Section titled “getCameraDevices()”
staticgetCameraDevices():Promise<CameraDevice[]>
Defined in: system/system.ts:133
return: Promise<CameraDevice[]>
Gets all camera devices See also: #system/CameraDevice System/CameraDevice
System.getCameraDevices().then(function(devices) { // devices is an array of CameraDevice object window.cameras = devices;});Returns
Section titled “Returns”Promise<CameraDevice[]>
getCursorPosition()
Section titled “getCursorPosition()”
staticgetCursorPosition():Promise<any>
Defined in: system/system.ts:340
return: Promise
Gets the position of the cursor. Does not work on Source Plugins.
System.getCursorPosition().then(function(pos) { var x = pos.x; // X Axis var y = pos.y; // Y Axis});Returns
Section titled “Returns”Promise<any>
getFonts()
Section titled “getFonts()”
staticgetFonts():Promise<string[]>
Defined in: system/system.ts:309
return: Promise<string[]>
Gets array of system-installed fonts
var mySelect = document.getElementById("mySelect");
System.getSystemFonts().then(function(fontsArray) { var fontsArrayLength = fontsArray.length; for (var i = 0; i < fontsArrayLength; ++i) { var option = document.createElement('option'); option.text = fontsArray[i]; mySelect.add(option); }});Returns
Section titled “Returns”Promise<string[]>
getGames()
Section titled “getGames()”
staticgetGames():Promise<Game[]>
Defined in: system/system.ts:179
return: Promise<Game[]>
Gets all currently running games See also: #system/Game System/Game
System.getGames().then(function(games) { // games is an array of Game object window.games = games;});Returns
Section titled “Returns”Promise<Game[]>
getMicrophones()
Section titled “getMicrophones()”
staticgetMicrophones():Promise<MicrophoneDevice[]>
Defined in: system/system.ts:208
return: Promise<MicrophoneDevice[]>
Gets all audio capture devices that may be added to the stage See also: #system/MicrophoneDevice System/MicrophoneDevice
System.getMicrophones().then(function(microphones) { microphones[0].addToScene(); // add first microphone to stage});Returns
Section titled “Returns”Promise<MicrophoneDevice[]>
setCursorPosition()
Section titled “setCursorPosition()”
staticsetCursorPosition(pos):Promise<unknown>
Defined in: system/system.ts:373
param: JSON: {x: number, y: number}
Sets the position of the cursor. Does not work on Source Plugins.
System.setCursorPosition({x:0, y:0});Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”Promise<unknown>