AppUtils

AppUtils

Provides tools and utils for the app.

Extends

Members

lowPowerMode :boolean

Flag if device is in low power mode.

Type:
  • boolean

microphoneMuted :boolean

Flag if the microphone is muted.

Type:
  • boolean

renderLoopPaused :boolean

Flag if the rendering is paused.

Type:
  • boolean

speakerMuted :boolean

Flag if the speaker is muted.

Type:
  • boolean

Methods

(async) closeApp(shutdown)

Sends a shutdown signal to the app. Used for device platforms that do not normally close running apps via task
manager. Works on Windows platform only.

Parameters:
Name Type Description
shutdown string

Completely shutdown app and free resources.

(async) downloadFile(path)

Downloads a file from Emscripten's local file structure.

Parameters:
Name Type Description
path string

local file path

(async) getAuthentication() → {string}

Retrieves the authentication key stored using setAuthentication function.

Returns:

authKey

Type
string

(async) getDeviceRamInfo() → {DeviceRamInfo}

Gets the RAM info of the device

Returns:
Type
DeviceRamInfo

(async) getResourceInfo(display) → {Object}

Get or display the memory resource infos.

Parameters:
Name Type Description
display bool

Print output as console table.

Returns:

resourceInfo

Type
Object

getSecureUrl(url) → {string}

Takes the given url and adds the https proxy in front of it. If a url uses already the https protocol or if
the url is no http url the unchanged url is returned.

Parameters:
Name Type Description
url string

the url to secure

Returns:

a secure url

Type
string

(async) httpPost(url, args) → {object}

Sends an HTTP POST request

Parameters:
Name Type Description
url string

target URL

args object

POST arguments (parameters)

Throws:

HTTP POST error

Type
Error
Returns:

HTTP POST result.

Type
object

(async) muteMicrophone()

Mute the microphone.

(async) muteSpeaker()

Mute the speaker.

off(eventName, eventHandler)

Inherited From:
Parameters:
Name Type Description
eventName string
eventHandler function

on(eventName, eventHandler)

Inherited From:
Parameters:
Name Type Description
eventName string
eventHandler function

once(eventName, eventHandler)

Inherited From:
Parameters:
Name Type Description
eventName string
eventHandler function

openUrl(url)

Opens the given URL in the device's browser. The app will go into background.

Parameters:
Name Type Description
url string

URL to be opened

(async) pauseRenderLoop()

Pauses the main render loop of the 3D engine. Freezes the engine output, but not the user interface, which remains
functional as usual. Any changes in the state of the app will not be redrawn until the render loop is resumed. This
frees up a lot of resources and may improve performance of background tasks such as download and insertion.
This method is idempotent.

(async) prepareCustomImage(url, fileNamenullable) → {string}

Downloads an image under the given URL. Does only work with png and jpeg files.

Parameters:
Name Type Attributes Description
url string

Image location.

fileName string <nullable>

File name to save the image under. If no filename is given, the sha1-hashed image url is used.

Returns:

Path to the downloaded image

Type
string

(async) resumeRenderLoop()

Resumes the render loop, allowing changes in the app state to be redrawn. Note that it might cause a delay if new
objects had been inserted into scene during the pause.
This method is idempotent.

(async) sendEmail(emailObject)

Opens the devices email client/form and fills it with the given data.

Parameters:
Name Type Description
emailObject EmailObject

object containing email data

(async) setAuthentication(authKey)

Persistently stores an authentication key. The purpose of this key is arbitrary and fully depends on the app logic.
The key persists between app executions and can be retrieved using getAuthentication function.

Parameters:
Name Type Description
authKey string

(async) setCollisionMode(collisionMode)

Sets the mode for the collision system.

Parameters:
Name Type Description
collisionMode number

Valid flags: 0 (COLLISION_DISABLED), 1 (COLLISION_ENABLED), 2 (COLLISION_NOTIFICATION).

(async) setTextureQuality(qualitynon-null, reloadScenenullable)

Sets the global texture quality to be used by the engine.

Parameters:
Name Type Attributes Default Description
quality string

One of "high", "medium", "low", "nextlower", or "nexthigher".

reloadScene boolean <nullable>
true

flag that specifies if the whole scene should be updated to the given quality

Throws:

Thrown if quality parameter has no valid value.

Type
Error

(async) unmuteMicrophone()

Unmute the microphone.

(async) unmuteSpeaker()

Unmute the speaker.

Events

deviceBackButtonPressed

Event that is emitted when the back button is pressed on android devices.