Namespace: utils

CTS. utils

Methods

<static> checkEndpoint(endpoint) → {CTS.endpoint.Endpoint}

Return a correct endpoint url
Parameters:
Name Type Description
endpoint string | CTS.endpoint.Endpoint The CTS API endpoint
Returns:
An endpoint
Type
CTS.endpoint.Endpoint

<static> dataEncode(data) → {string}

Encode data for XHR
Parameters:
Name Type Description
data Object.<string, any> A dictionary where keys are string
Returns:
The url encoded parameters
Type
string

<static> parseInt(str) → {integer}

Parse an urn identifier into an int for comparison
Parameters:
Name Type Description
str string | integer | Array.<(string|integer)> Data to be parsed
Deprecated:
  • Not use anymore as technically, passage don't have to be in ascending order
Returns:
Integer representing the urn identifier
Type
integer

<static> uriParam() → {Object.<string, any>}

Get the window location parameters (GET parameters)
Returns:
Boolean indicating if the passage is valid
Type
Object.<string, any>

<static> validPassage($start, $end) → {boolean}

Check if passage identifier are valid
Parameters:
Name Type Description
$start Array.<(string|integer|Array)> Start element
$end Array.<(string|integer|Array)> End element
Deprecated:
  • Not use anymore as technically, passage don't have to be in ascending order
Returns:
Boolean indicating if the passage is valid
Type
boolean

<static> xhr(method, url)

Just an XmlHttpRequest helper
Parameters:
Name Type Argument Description
method string HTTP Method
url string HTTP URI to call
options.success function <nullable>
Function to call when request is done.
options.type string Type of data wished (default: text/xml)
options.data any Data to send
options.error function <nullable>
Function to call when request gave an error.