Describes utilities in the Javascript API to get information about the app.

sys.app

This package contains methods to get information about the app, like name, URL, current environment, etc.

getLabel()

Returns the label of app in execution.

Returns

string - The label of the app.

Samples

// logs the label of the app

log('app: '+sys.app.getLabel());

getName()

Returns the name of app in execution.

Returns

string - The name of the app.

Samples

// logs the name of the app

log('app: '+sys.app.getName());

getEnv()

Returns the name of the environment in execution. It could be prod or dev.

Returns

string - The name of the environment in execution.

Samples

// logs the name of the environment

log('env: '+sys.app.getEnv());

getUrl()

Returns the URL of app in execution. It could be something like https://yourapp.slingrs.io/dev/runtime or https://yourapp.slingrs.io/prod/runtime.

Returns

string - The URL of the app.

Samples

// logs the URL of the app

log('app url: '+sys.app.getUrl());

getVersion()

Returns the version of app in execution. It is a timestamp.

Returns

number - The version of the app.

Samples

// logs the version of the app

log('app url: '+sys.app.getVersion());

getDefaultLanguage()

Return the language code of the default language used in the app.

Returns

string - Language code used in the app

Samples

// logs the default language of the app

log('app language: ' + sys.app.getDefaultLanguage());

getDefaultTimezone()

Return the id and label of the default timezone used in the app.

Returns

object - ID and label of the default timezone used in the app.

Samples

// logs the default timezone of the app

log('app timezone: ' + JSON.stringify(sys.app.getDefaultTimezone()));
Back to top