utils

format(template, ...)

Substitutes each occurence of the curly brackets enclosed number n with the with the n+1 additional argument.

Arguments:
  • template (String) – The template to use.
  • ... (String) – The substitute.
Returns:

The processed string.

Return type:

String

Example:

format(“foo {0}!”, “bar”) == “foo bar!”

uuid([, length])

Generates a UUID cosisting of upper and lower case characters and numbers at random.

Arguments:
  • length (Number) – The length of the rquested UUID. Defaults to 10.
Returns:

The UUID.

Return type:

String

capitalize(string)

Capitalizes the first character of the given string with toUpperCase, hence is not resprecting the locale specific case definitions.

Arguments:
  • string (String) – The input string.
Returns:

The capitalized string.

Return type:

String

callback(callback)

Used for callback type checking and defaulting.

Arguments:
  • callback (Function) – The callback to check. If it is not a function it will return

an empty funciton.

Returns:A proper callback function, the provided one if it is valid.
Return type:Function
ROP(value)

Return a property descriptor for a read-only property, which is sitll configurable and enumerable. It also containes the descriptor flag required for JClass property definitions.

Arguments:
  • value (Any) – The value of the property.
Returns:

A property descriptior that is JClass ready.

Return type:

Object

setROP(object, name, value)

Sets a read only (but still configurable and enumerable) property on the given object.

Arguments:
  • object (Object) – The object to set the property on.
  • name (String) – The name of the property.
  • value (Any) – The value to set the property to.
Returns:

The value.

Return type:

Any

asyncRequire(path)

Interfaces the a require calls into the async callback system.

Arguments:
  • path (String) – The path to require.
Returns:

A function that prefroms the require call and accepts an callback(err, returnValue)

Return type:

Function

formatDate(data[, options])
Format s date object appropriately.
Arguments:
  • date (Date) – The date to format.
  • options (Object) – Further options for the formatting. (none supported yet)
Returns:

The formatted date.

Return type:

String

shortcutPP(definition[, os])

Shortcut preprocessing

Arguments:
  • definition (String) – The shortcuts definition.
  • os (String) – The OS for which the shortcuts should be preprocessed. If not given, the value from vispa.device.os will be used.
Returns:

The shortcut ready to be handles by the jQuery.Shortcuts plugin.

Return type:

String