Scripting Build-Ins

Overview

The Spectator scripting engines provides some common and some new built-in functions. This documentation lists the built-ins and the API.

Module HTTP

Function get

HTTP.get makes a GET-request.

Arguments:

url : String - Destination of the request

Returns:

response : Response

Function post

HTTP.post makes a POST-request.

Arguments:

url : String - Destination of the request headers : Object - Header List

Returns:

response : Response

Function put

HTTP.put makes a PUT-request.

Arguments:

url : String - Destination of the request headers : Object - Header List

Returns:

response : Response

Function patch

HTTP.patch makes a PATCH-request.

Arguments:

url : String - Destination of the request headers : Object - Header List

Returns:

response : Response

Function destroy

HTTP.destroy makes a DESTROY-request.

Arguments:

url : String - Destination of the request headers : Object - Header List

Returns:

response : Response

Function head

HTTP.head makes a HEAD-request.

Arguments:

url : String - Destination of the request headers : Object - Header List

Returns:

response : Response

Module Console

Function log

console.log writes a string to the console.

Arguments:

args : Any[] - Accepts an array of arguments of any type and logs each argument to the console

Returns:

Nothing returned

Function warning

console.warning writes a warning-string to the console.

Arguments:

args : Any[] - Accepts an array of arguments of any type and logs each argument to the console

Returns:

Nothing returned

Function error

console.error writes a error-string to the console.

Arguments:

args : Any[] - Accepts an array of arguments of any type and logs each argument to the console

Returns:

Nothing returned

Global Helper

Function UrlEncoded

Url encodes multiple key-value pairs.

Arguments:

entries : Object - A flat object of key-value pairs.

Returns:

encoded : UrlEncoded

Function FormData

Transforms multiple key-value pairs to a FormData object.

Arguments:

entries : Object - A flat object of key-value pairs.

Returns:

formData : FormData