The Spectator scripting engines provides some common and some new built-in functions. This documentation lists the built-ins and the API.
get
HTTP.get
makes a GET-request.
Arguments:
url : String - Destination of the request
Returns:
response : Response
post
HTTP.post
makes a POST-request.
Arguments:
url : String - Destination of the request headers : Object - Header List
Returns:
response : Response
put
HTTP.put
makes a PUT-request.
Arguments:
url : String - Destination of the request headers : Object - Header List
Returns:
response : Response
patch
HTTP.patch
makes a PATCH-request.
Arguments:
url : String - Destination of the request headers : Object - Header List
Returns:
response : Response
destroy
HTTP.destroy
makes a DESTROY-request.
Arguments:
url : String - Destination of the request headers : Object - Header List
Returns:
response : Response
head
HTTP.head
makes a HEAD-request.
Arguments:
url : String - Destination of the request headers : Object - Header List
Returns:
response : Response
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
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
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
UrlEncoded
Url encodes multiple key-value pairs.
Arguments:
entries : Object - A flat object of key-value pairs.
Returns:
encoded : UrlEncoded
FormData
Transforms multiple key-value pairs to a FormData object.
Arguments:
entries : Object - A flat object of key-value pairs.
Returns:
formData : FormData