Common Utils

This section describes a core API that can be used in different application parts such as widgets, data and the application framework.

Type: Object

cancelAnimationFrame(requestID)

Cancels an animation frame request scheduled with the requestAnimationFrame method.

Parameters:
requestID: Number
The identifier returned by requestAnimationFrame method.

This method acts as a normalization of the standard cancelAnimationFrame method of the window object.

JavaScript
window.cancelAnimationFrame ||
    window.webkitCancelAnimationFrame ||
    window.mozCancelAnimationFrame ||
    window.oCancelAnimationFrame ||
    window.msCancelAnimationFrame

If the API in the code above is not supported, the devexpress.cancelAnimationFrame(requestID) method clears a timer set with the requestAnimationFrame method.

devices

An object that serves as a namespace for the methods and events specifying information on the current device.

Included in: dx.phonejs.js, dx.webappjs.js, dx.chartjs.js, dx.all.js

EndpointSelector

Used to get URLs that vary in a locally running application and the application running on production.

Type: Object

Create an instance of the EndpointSelector object passing a configuration object of a specific structure as a parameter.

JavaScript
var endpointSelector = new DevExpress.EndpointSelector(Application1.config.endpoints);
JavaScript
Application1.config.endpoints: {
    variant1: {
        local: "",
        production: ""
    },
    variant2: {
        local: "",
        production: ""
    },
    ...
}

As you can see in the code above, you can specify several pairs of links. Each of these pairs includes a link for a locally running application and a link for the application running in production mode. Fields for these pairs can be named as you like.

NOTE: You can use a JSON format for the configuration object.

To get a URL, use the urlFor method of your EndpointSelector instance passing the name of the required links variant as a parameter. The method will return a local or a productional URL depending on how the application is currently running.

Errors and Warnings

This section lists core errors and warnings that may occur in DevExtreme applications.

fx

An object that serves as a namespace for the methods that are used to animate UI elements.

Included in: dx.phonejs.js, dx.webappjs.js, dx.chartjs.js, dx.all.js

processHardwareBackButton()

Processes the hardware back button click.

When building a mobile application, you should initiate processing of the hardware back button click. The following code demonstrates how to do this by calling the processHardwareBackButton() method within the event listener of the PhoneGap backbutton event.

JavaScript
$(function() {
    document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
        //...
        document.addEventListener("backbutton", onBackButton, false);
    }
    function onBackButton() {
        DevExpress.processHardwareBackButton();
    }   
    //...   
}

To handle the back button click, subscribe to the HtmlApplication.navigatingBack() event and use the isHardwareButton event handler parameter within the handling function.

requestAnimationFrame(callback)

Requests that the browser call a specified function to update animation before the next repaint.

Parameters:
callback: function
Specifies the function to call when it's time to update your animation for the next repaint.
Return Value: Number
The request id that uniquely identifies the entry in the callback list.

This method acts as a normalization of the standard requestAnimationFrame method of the window object:

JavaScript
window.requestAnimationFrame ||
    window.webkitRequestAnimationFrame ||
    window.mozRequestAnimationFrame ||
    window.oRequestAnimationFrame ||
    window.msRequestAnimationFrame

If the API in the code above is not supported, the devexpress.requestAnimationFrame(callback) method calls the function passed as a parameter after an internally set timeout.

rtlEnabled

Specifies whether or not the entire application/site supports right-to-left representation.

Type: Boolean
Default Value: false

The most common scenario is to switch the entire application/site to a right-to-left representation. In this instance, use the DevExpress.rtlEnabled field. When this option is set to true, applications built using the DevExtreme framework and sites based on DevExtreme widgets will have a right-to-left reading order, mirroring of UI elements and reversed transition animation. If you need to switch the display of each DevExtreme component used within the application/site to a right-to-left representation, use a specifically designed configuration option - rtlEnabled.

ui

An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications.

Included in: dx.phonejs.js, dx.webappjs.js, dx.chartjs.js, dx.all.js

utils

An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets.

Included in: dx.phonejs.js, dx.webappjs.js, dx.chartjs.js, dx.all.js

validationEngine

An object that serves as a namespace for the methods required to perform validation.