Help prepare for 2025 → Answer 8 simple questions on our Fall Survey
Open Survey

Summary

References

Variables

CORE_ANIMATION_DEFAULTS

CORE_ANIMATION_DEFAULTS: {
  duration: number
}
Default animation values used throughout core

FILE_PREFIX

FILE_PREFIX: string

RESOURCE_PREFIX

RESOURCE_PREFIX: string

SDK_VERSION

SDK_VERSION: number

debug

debug: boolean
A runtime option indicating whether the build has debugging enabled.

Functions

GC

GC(): any
An utility function that invokes garbage collection on the JavaScript side.
Returns any

clearInterval

clearInterval(id: number): void
Clears repeated function which was set up by calling setInterval().
Parameter Default Description
id
number

The identifier returned by the setInterval() method.

Returns void

clearTimeout

clearTimeout(id: number): void
Clears the delay set by a call to the setTimeout function.
Parameter Default Description
id
number

The identifier returned by the previously called setTimeout() method.

Returns void

convertString

convertString(value: any): any
Converts string value to number or boolean.
Parameter Default Description
value
any

The original value.

Returns any

copyToClipboard

copyToClipboard(value: string): void
Copy value to device clipboard.
Parameter Default Description
value
string

Returns void

dataDeserialize

dataDeserialize(nativeData?: any): any
Data deserialization from Native > JS
Parameter Default Description
nativeData
any

Native platform data

Returns any

dataSerialize

dataSerialize(data?: any, wrapPrimitives?: boolean): any
Data serialization from JS > Native
Parameter Default Description
data
any

wrapPrimitives
boolean

Optionally wrap primitive types (Some APIs may require this)

Returns any

debounce

debounce(fn: any, delay?: number): any
A simple debounce utility
Parameter Default Description
fn
any

Function to debounce

delay
number

Customize the delay (default is 300ms)

Returns any

dismissKeyboard

dismissKeyboard(): void
Dismiss any keyboard visible on the screen.
Returns void

dismissSoftInput

dismissSoftInput(nativeView?: any): void
Hides the soft input method, usually a soft keyboard.
Parameter Default Description
nativeView
any

Returns void

dispatchToMainThread

dispatchToMainThread(func: Function): any
Dispatches the passed function for execution on the main thread
Parameter Default Description
func
Function

The function to execute on the main thread.

Returns any

dispatchToUIThread

dispatchToUIThread(func: Function): any
Dispatches the passed function for execution on the UI thread
Parameter Default Description
func
Function

The function to execute on the UI thread.

Returns any

eliminateDuplicates

eliminateDuplicates(arr: any[]): any[]
Removes duplicate elements from array.
Parameter Default Description
arr
any[]

The array.

Returns any[]

escapeRegexSymbols

escapeRegexSymbols(source: string): string
Escapes special regex symbols (., *, ^, $ and so on) in string in order to create a valid regex from it.
Parameter Default Description
source
string

The original value.

Returns string

executeOnMainThread

executeOnMainThread(func: Function): any
Checks if the current thread is the main thread. Directly calls the passed function if it is, or dispatches it to the main thread otherwise.
Parameter Default Description
func
Function

The function to execute on the main thread.

Returns any

executeOnUIThread

executeOnUIThread(func: Function): any
Runs the passed function on the UI Thread.
Parameter Default Description
func
Function

The function to execute on the UI thread.

Returns any

getBaseClasses

getBaseClasses(object: any): string[]
A function that gets the entire class hierarchy of an object.
Parameter Default Description
object
any

The object. Returns an array of strings with the name of all base classes.

Returns string[]

getClass

getClass(object: any): string
A function that gets the class name of an object.
Parameter Default Description
object
any

The object. Returns a string with the name of the class.

Returns string

getClassInfo

getClassInfo(object: Object): ClassInfo
A function that gets the ClassInfo for an object.
Parameter Default Description
object
Object

The object. Returns a ClassInfo for the object.

Returns ClassInfo

getDurationWithDampingFromSpring

getDurationWithDampingFromSpring(springSettings?: {
  friction?: number
  mass?: number
  tension?: number
}): {
  damping: number
}
Get a duration with damping value from various spring related settings. Helpful when needing to convert spring settings to isolated duration value.
Parameter Default Description
springSettings
{ friction?: number mass?: number tension?: number }

various spring settings

Returns { damping: number }

getFileExtension

getFileExtension(path: string): string
Get file extension from file path
Parameter Default Description
path
string

file path

Returns string

getModuleName

getModuleName(path: string): string
Gets module name from path.
Parameter Default Description
path
string

The module path.

Returns string

hasDuplicates

hasDuplicates(arr: any[]): boolean
Checks if array has any duplicate elements.
Parameter Default Description
arr
any[]

The array to be checked.

Returns boolean

isBoolean

isBoolean(value: any): boolean
A function that checks if something is a valid boolean.
Parameter Default Description
value
any

The value which will be checked. Returns true if value is a boolean.

Returns boolean

isDataURI

isDataURI(uri: string): boolean
Returns true if the specified URI is data URI (http://en.wikipedia.org/wiki/Data_URI_scheme).
Parameter Default Description
uri
string

The URI.

Returns boolean

isDefined

isDefined(value: any): boolean
A function that checks if something is defined (not undefined).
Parameter Default Description
value
any

The value which will be checked. Returns true if value is defined.

Returns boolean

isEmoji

isEmoji(value: string): boolean
Parameter Default Description
value
string

Returns boolean

isFileOrResourcePath

isFileOrResourcePath(path: string): boolean
Returns true if the specified path points to a resource or local file.
Parameter Default Description
path
string

The path.

Returns boolean

isFontIconURI

isFontIconURI(uri: string): boolean
Returns true if the specified URI is a font icon URI like "fontIcon://".
Parameter Default Description
uri
string

The URI.

Returns boolean

isFunction

isFunction(value: any): boolean
A function that checks if something is a function.
Parameter Default Description
value
any

The value which will be checked. Returns true if value is a function.

Returns boolean

isMainThread

isMainThread(): boolean

isNullOrUndefined

isNullOrUndefined(value: any): boolean
A function that checks if something is not defined (null or undefined).
Parameter Default Description
value
any

The value which will be checked. Returns true if value is null or undefined.

Returns boolean

isNumber

isNumber(value: any): boolean
A function that checks if something is a valid number.
Parameter Default Description
value
any

The value which will be checked. Returns true if value is a number.

Returns boolean

isObject

isObject(value: any): boolean
A function that checks if something is an object.
Parameter Default Description
value
any

The value which will be checked. Returns true if value is an object.

Returns boolean

isRealDevice

isRealDevice(): boolean
Checks whether the application is running on real device and not on simulator/emulator.
Returns boolean

isString

isString(value: any): boolean
A function that checks if something is a valid string.
Parameter Default Description
value
any

The value which will be checked. Returns true if value is a string.

Returns boolean

isUndefined

isUndefined(value: any): boolean
A function that checks if something is "undefined".
Parameter Default Description
value
any

The value which will be checked. Returns true if value is "undefined".

Returns boolean

mainThreadify

mainThreadify(func: Function): (...args: any[]) => void
Returns a function wrapper which executes the supplied function on the main thread. The wrapper behaves like the original function and passes all of its arguments BUT discards its return value.
Parameter Default Description
func
Function

The function to execute on the main thread

Returns (...args: any[]) => void

merge

merge(left: any, right: any, compareFunc: any): any[]
Parameter Default Description
left
any

right
any

compareFunc
any

Returns any[]

mergeSort

mergeSort(arr: any[], compareFunc: (a: any, b: any) => number): any[]
Sorts an array by using merge sort algorithm (which ensures stable sort since the built-in Array.sort() does not promise a stable sort).
Parameter Default Description
arr
any[]

array to be sorted

compareFunc
(a: any, b: any) => number

function that will be used to compare two elements of the array

Returns any[]

numberHasDecimals

numberHasDecimals(value: number): boolean
Checks if the number has decimals
Parameter Default Description
value
number

Number to check

Returns boolean

numberIs64Bit

numberIs64Bit(value: number): boolean
Checks if the number is 64 bit
Parameter Default Description
value
number

Number to check

Returns boolean

openFile

openFile(filePath: string, title?: string): boolean
Opens file.
Parameter Default Description
filePath
string

The file.

title
string

Optional title for Android. Default is: 'Open File...'

Returns boolean

openUrl

openUrl(url: string): boolean
Opens url.
Parameter Default Description
url
string

The url.

Returns boolean

queueGC

queueGC(delay?: number, useThrottle?: boolean): any
An utility function that queues a garbage collection, multiple calls in quick succession are debounced by default and only one gc will be executed after 900ms.
Parameter Default Description
delay
number

Customize the delay

useThrottle
boolean

Instead of default debounce strategy, use throttling

Returns any

queueMacrotask

queueMacrotask(task: () => void): void
Queues the passed function to be ran in a macroTask
Parameter Default Description
task
() => void

the function to execute as a macroTask

Returns void

releaseNativeObject

releaseNativeObject(object: any): any
Releases the reference to the wrapped native object
Parameter Default Description
object
any

The Java/Objective-C object to release.

Returns any

sanitizeModuleName

sanitizeModuleName(moduleName: string, removeExtension?: boolean): string
Helps sanitize a module name if it is prefixed with '~/', '~' or '/'
Parameter Default Description
moduleName
string

the name

removeExtension
boolean

whether to remove extension

Returns string

setInterval

setInterval(callback: Function, milliseconds?: number, ...args: any[]): number
Calls a function repeatedly with a delay between each call.
Parameter Default Description
callback
Function

The function to be called.

milliseconds
number

The delay between each function call.

args
any[]

One or more parameter to use once the function is called. Defaults to no parameters.

Returns number

setTimeout

setTimeout(callback: Function, milliseconds?: number, ...args: any[]): number
Calls a function after a specified delay.
Parameter Default Description
callback
Function

The function to be called.

milliseconds
number

The time to wait before the function is called. Defaults to 0.

args
any[]

One or more parameter to use once the function is called. Defaults to no parameters.

Returns number

throttle

throttle(fn: any, delay?: number): any
A simple throttle utility
Parameter Default Description
fn
any

Function to throttle

delay
number

Customize the delay (default is 300ms)

Returns any

toUIString

toUIString(object: any): string
Returns a string representation of an object to be shown in UI.
Parameter Default Description
object
any

The object.

Returns string

verifyCallback

verifyCallback(value: any): void
A function that checks if something is a valid function.
Parameter Default Description
value
any

The value which will be checked. Throws exception if passed value is not a valid function.

Returns void
Previous
Trace