Class: Runtime

jrt.Runtime

App loader and runtime utility class. If Apache Cordova is detected, the app will run as an installed Cordova app. Otherwise, it will run as a regular web app.

This runtime creates the app as an instance of jrt.App. The concrete class that implements your app must be specified in the class attribute of the jRT library's SCRIPT element (which must appear in the HEAD element before your app's own scripts). If no class is specified, a direct instance of jrt.App will be used.

The app's constructor is called when both the DOM and the Cordova APIs (if available) are ready. Then the app's start page will be shown and the "ready" token will be be added to the HTML element's class attribute.

Members

(static, constant) isTouch :boolean

Tells if the app is running in a touch device.

Type:
  • boolean

(static, constant, non-null) location :URL

The URL form where the app was loaded. The runtime removes the URL parameters from the initial URL, but you can get them from here, if needed. The initial URL hash is also removed and ignored, since this framework allows only one start page (which can be specified with jrt.App#mainPageId).

Type:
  • URL

(static, constant) platform :string

This will be "web" when running in a web browser (without Cordova). When running with Cordova, this contains the same as the cordova.platformId property.

Type:
  • string

Methods

(static) exit()

Exits the app, if running as installed app. Otherwise, it does nothing.

(static) isOffline() → (nullable) {boolean}

Tells if the app is offline. This will be null if it's unknown.

Returns:
Type
boolean

(static) reload()

Restarts the app by reloading its URL without parameters.

Throws:

An error is always thrown in order to stop execution of client code.

Type
jrt.JrtError

(static) restart()

Restarts the app by restoring the initial HTML contents and recreating the app instance.

Throws:

An error is always thrown in order to stop execution of client code.

Type
jrt.JrtError