OpenLayers Base Types

OpenLayers custom string, number and function functions are described here.

Summary
OpenLayers custom string, number and function functions are described here.
Test whether a string starts with another string.
Test whether a string contains another string.
Removes leading and trailing whitespace characters from a string.
Camel-case a hyphenated string.
Deprecated.
Deprecated.
Deprecated.
Deprecated.
Limit the number of significant digits on an integer.
Deprecated.
Bind a function to an object.
Bind a function to an object, and configure it to receive the event object as first parameter when called.
Deprecated.
Deprecated.

Functions

OpenLayers. String. startsWith

Test whether a string starts with another string.

Parameters

str{String} The string to test.
sub{Sring} The substring to look for.

Returns

{Boolean} The first string starts with the second.

OpenLayers. String. contains

Test whether a string contains another string.

Parameters

str{String} The string to test.
sub{String} The substring to look for.

Returns

{Boolean} The first string contains the second.

OpenLayers. String.trim

Removes leading and trailing whitespace characters from a string.

Parameters

str{String} The (potentially) space padded string.  This string is not modified.

Returns

{String} A trimmed version of the string with all leading and trailing spaces removed.

OpenLayers. String. camelize

Camel-case a hyphenated string.  Ex.  “chicken-head” becomes “chickenHead”, and “-chicken-head” becomes “ChickenHead”.

Parameters

str{String} The string to be camelized.  The original is not modified.

Returns

{String} The string, camelized

String. startsWith

Deprecated.  Whether or not a string starts with another string.

Parameters

sStart{Sring} The string we’re testing for.

Returns

{Boolean} Whether or not this string starts with the string passed in.

String. contains

Deprecated.  Whether or not a string contains another string.

Parameters

str{String} The string that we’re testing for.

Returns

{Boolean} Whether or not this string contains with the string passed in.

String.trim

Deprecated.  Removes leading and trailing whitespace characters from a string.

Returns

{String} A trimmed version of the stringall leading and trailing spaces removed

String. camelize

Deprecated.  Camel-case a hyphenated string.  Ex.  “chicken-head” becomes “chickenHead”, and “-chicken-head” becomes “ChickenHead”.

Returns

{String} The string, camelized

OpenLayers. Number. limitSigDigs

Limit the number of significant digits on an integer.

Parameters

num{Integer}
sig{Integer}

Returns

{Integer} The number, rounded to the specified number of significant digits.

Number. limitSigDigs

Deprecated.  Limit the number of significant digits on an integer.  Does not work with floats!

Parameters

sig{Integer}

Returns

{Integer} The number, rounded to the specified number of significant digits.  If null, 0, or negative value passed in, returns 0

OpenLayers. Function.bind

Bind a function to an object.  Method to easily create closures with ‘this’ altered.

Parameters

func{Function} Input function.
object{Object} The object to bind to the input function (as this).

Returns

{Function} A closure with ‘this’ set to the passed in object.

OpenLayers. Function. bindAsEventListener

Bind a function to an object, and configure it to receive the event object as first parameter when called.

Parameters

func{Function} Input function to serve as an event listener.
object{Object} A reference to this.

Returns

{Function}

Function.bind

Deprecated.  Bind a function to an object.  Method to easily create closures with ‘this’ altered.

Parameters

object{Object} the this parameter

Returns

{Function} A closure with ‘this’ altered to the first argument.

Function. bindAsEventListener

Deprecated.  Bind a function to an object, and configure it to receive the event object as first parameter when called.

Parameters

object{Object} A reference to this.

Returns

{Function}