Namespace: Config

Oracle® JavaScript Extension Toolkit (JET)
15.1.0

F83698-01

Since:
  • 1.0
Module:
  • ojconfig

QuickNav

Description

Services for setting and retrieving configuration options


Usage

Typescript Import Format
//This namespace exports multiple static methods or members. To import 
import * as Config from "ojs/ojconfig";

//Now you can access the methods as Config.methodName and so on

For additional information visit:


Methods

(static) getAutomationMode : {string}

Gets the automation mode.
See:
Returns:

automation mode

Type
string

(static) getDeviceRenderMode : {"phone"|"tablet"|"others"}

Retrieves the render mode the application should use. This allows the application to render content differently based on the type of device.

By default, this function returns the value from getDeviceType.

An application can override it by adding a "data-oj-device-render-mode" attribute with the desired value to the document body. This may be useful in simulating the look of one device type on a different device type, such as simulating the look of "phone" on a destop computer.

Returns:

The render mode

Type
"phone" | "tablet" | "others"

(static) getDeviceType : {"phone"|"tablet"|"others"}

Retrieves the type of device the application is running on. This allows the application to behave differently based on the type of device.

This function always return the actual device type. Use getDeviceRenderMode if the application wants to render content differently based on the device type, including simulated device type.

Returns:

The device type

Type
"phone" | "tablet" | "others"

(static) getLocale : {string}

Retrieves the current locale
Returns:

current locale

Type
string

(static) getResourceUrl(relativePath) : {string}

Retrieves a URL for loading a component-specific resource. The URL is resolved as follows: 1. If the application has specified a base URL with setResourceBaseUrl(), the return values will be a relative path appended to the base URL. 2. Otherwise, if the application running with an AMD Loader (such as Require.js), the parent folder of a module with ojs/ mapping will be used as a base URL. 3. Otherwise, the original relative path will be returned.
Parameters:
Name Type Description
relativePath string resource path
See:
Returns:

resource URL

Type
string

(static) getVersionInfo : {string}

Return a string containing important version information about JET and the libraries it has loaded
Returns:
Type
string

(static) logVersionInfo : {undefined}

Dump information to the browser's console containing important version information about JET and the libraries it has loaded
Returns:
Type
undefined

(static) setAutomationMode(mode) : {undefined}

Sets the automation mode.
Parameters:
Name Type Description
mode string "enabled" for running in automation mode
See:
Returns:
Type
undefined

(static) setExpressionEvaluator(expressionEvaluator) : {undefined}

Sets an optional CSP-compliant expression evaluator for the JET binding provider and JET ExpressionUtils. This method can only be called once and must be called before applying knockout bindings in the application for the first time.
Parameters:
Name Type Description
expressionEvaluator oj.CspExpressionEvaluator An instance of CspExpressionEvaluator class
Since:
  • 7.1.0
See:
Returns:
Type
undefined

(static) setLocale(locale, callback) : {undefined}

Changes the current locale dynamically. Dynamically changing the UI locale often ends up with the UI in mixed languages or locales because the application may have cached data that are locale sensitive.

The preferred method to change the locale is to reload the page and either set the 'lang' attribute on the html element of the page generated on the server, or set the 'locale' option for the ojL10n plugin on the client when requireJS is configured.

Parameters:
Name Type Argument Description
locale string (language code and subtags separated by dash)
callback function(): void <optional>
this optional callback will be invoked when the framework is done loading its translated resources and Locale Elements for the newly specified locale.
Returns:
Type
undefined

(static) setResourceBaseUrl(baseUrl) : {undefined}

Sets the base URL for retrieving component-specific resources
Parameters:
Name Type Description
baseUrl string base URL
See:
Returns:
Type
undefined