A newer version of this page is available. Switch to the current version.

jQuery Common - Utils - utils

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

cancelAnimationFrame(requestID)

Cancels an animation frame request scheduled with the requestAnimationFrame method.

import { cancel } from "devextreme/animation/frame"
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.utils.cancelAnimationFrame(requestID) method clears a timer set with the requestAnimationFrame method.

initMobileViewport(options)

Sets parameters for the viewport meta tag. Takes effect for mobile applications only.

import initMobileViewport from "devextreme/mobile/init_mobile_viewport"
Parameters:
options:

Object

Gesture configuration for a mobile browser's viewport.

Object structure:
Name Type Description
allowPan

Boolean

Specifies whether to enable panning on the vertical and horizontal axes.

allowSelection

Boolean

Specifies whether to enable selection.

allowZoom

Boolean

Specifies whether to enable pinch-zooming.

requestAnimationFrame(callback)

Makes the browser call a function to update animation before the next repaint.

import { request } from "devextreme/animation/frame"
Parameters:
callback:

Function

The function.

Return Value:

Number

The current request's ID.

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.utils.requestAnimationFrame(callback) method calls the function passed as a parameter after an internally set timeout.