API Docs for: 0.0.1
Show:

IO Class

Defined in: src/itsa-io/io.js:1
Module: io-xml
Parent Module: io

Provides core IO-functionality.

Methods

_getClientId

(
  • url
)
Promise private

Provided by the io-filetransfer module.

Defined in src/io/extra/io-filetransfer.js:94

Is send to the server and expects an unique id which can be used for its file-transactions.

Parameters:

  • url String

    URL of the resource server

Returns:

Promise:

on success: Unique clientId on failure an Error object reason {Error}

_getClientId

(
  • url
)
Promise private

Provided by the io-filetransfer module.

Defined in src/io kopie/extra/io-filetransfer.js:94

Is send to the server and expects an unique id which can be used for its file-transactions.

Parameters:

  • url String

    URL of the resource server

Returns:

Promise:

on success: Unique clientId on failure an Error object reason {Error}

_getClientId

(
  • url
)
Promise private

Provided by the io-filetransfer module.

Defined in src/itsa-io/extra/io-filetransfer.js:94

Is send to the server and expects an unique id which can be used for its file-transactions.

Parameters:

  • url String

    URL of the resource server

Returns:

Promise:

on success: Unique clientId on failure an Error object reason {Error}

_initXHR

(
  • xhr
  • options
  • fulfill
  • reject
  • promise
)
private

Provided by the io module.

Defined in src/io kopie/io.js:65

Initializes the xhr-instance, based on the config-params. This method is the standard way of doing xhr-requests without processing streams.

Parameters:

  • xhr Object

    xhr-instance

  • options Object
    • [url] String optional

      The url to which the request is sent.

    • [method='GET'] String optional

      The HTTP method to use. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true. This feature only works in the browser: nodejs will always perform asynchronous requests.

    • [data] Object optional

      Data to be sent to the server, either to be used by query-params or body.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

  • fulfill Function

    reference to xhr-promise's fulfill-function

  • reject Function

    reference to xhr-promise's reject-function

  • promise Promise

    the xhr-promise which will be extended with the abort()-method

_initXHR

(
  • xhr
  • options
  • fulfill
  • reject
  • promise
)
private

Provided by the io module.

Defined in src/itsa-io/io.js:65

Initializes the xhr-instance, based on the config-params. This method is the standard way of doing xhr-requests without processing streams.

Parameters:

  • xhr Object

    xhr-instance

  • options Object
    • [url] String optional

      The url to which the request is sent.

    • [method='GET'] String optional

      The HTTP method to use. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true. This feature only works in the browser: nodejs will always perform asynchronous requests.

    • [data] Object optional

      Data to be sent to the server, either to be used by query-params or body.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

  • fulfill Function

    reference to xhr-promise's fulfill-function

  • reject Function

    reference to xhr-promise's reject-function

  • promise Promise

    the xhr-promise which will be extended with the abort()-method

_initXHR

(
  • xhr
  • options
  • fulfill
  • reject
  • promise
)
private

Provided by the io module.

Defined in src/io/io.js:65

Initializes the xhr-instance, based on the config-params. This method is the standard way of doing xhr-requests without processing streams.

Parameters:

  • xhr Object

    xhr-instance

  • options Object
    • [url] String optional

      The url to which the request is sent.

    • [method='GET'] String optional

      The HTTP method to use. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true. This feature only works in the browser: nodejs will always perform asynchronous requests.

    • [data] Object optional

      Data to be sent to the server, either to be used by query-params or body.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

  • fulfill Function

    reference to xhr-promise's fulfill-function

  • reject Function

    reference to xhr-promise's reject-function

  • promise Promise

    the xhr-promise which will be extended with the abort()-method

_readyHandleXDR

(
  • xhr
  • promise
)
private

Provided by the io-jsonp module.

Defined in src/io kopie/extra/io-stream.js:86

Adds 2 methods on the xhr-instance which are used by xhr when events occur:

xhr.onload() xhr.onerror() // only XMLHttpRequest2

These events are only added in case of XDR

Parameters:

  • xhr Object

    containing the xhr-instance

  • promise Promise

    reference to the Promise created by xhr

_readyHandleXDR

(
  • xhr
  • promise
)
private

Provided by the io-jsonp module.

Defined in src/io/extra/io-stream.js:86

Adds 2 methods on the xhr-instance which are used by xhr when events occur:

xhr.onload() xhr.onerror() // only XMLHttpRequest2

These events are only added in case of XDR

Parameters:

  • xhr Object

    containing the xhr-instance

  • promise Promise

    reference to the Promise created by xhr

_readyHandleXDR

(
  • xhr
  • promise
)
private

Provided by the io-jsonp module.

Defined in src/itsa-io/extra/io-stream.js:86

Adds 2 methods on the xhr-instance which are used by xhr when events occur:

xhr.onload() xhr.onerror() // only XMLHttpRequest2

These events are only added in case of XDR

Parameters:

  • xhr Object

    containing the xhr-instance

  • promise Promise

    reference to the Promise created by xhr

_setHeaders

(
  • xhr
  • headers
  • method
)
private

Provided by the io module.

Defined in src/itsa-io/io.js:156

Adds the headers-object to xhr-headers.

Parameters:

  • xhr Object

    containing the xhr-instance

  • headers Object

    containing all headers

  • method String

    the request-method used

_setHeaders

(
  • xhr
  • headers
  • method
)
private

Provided by the io module.

Defined in src/io/io.js:156

Adds the headers-object to xhr-headers.

Parameters:

  • xhr Object

    containing the xhr-instance

  • headers Object

    containing all headers

  • method String

    the request-method used

_setHeaders

(
  • xhr
  • headers
  • method
)
private

Provided by the io module.

Defined in src/io kopie/io.js:156

Adds the headers-object to xhr-headers.

Parameters:

  • xhr Object

    containing the xhr-instance

  • headers Object

    containing all headers

  • method String

    the request-method used

_setReadyHandle

(
  • xhr
  • fulfill
  • reject
)
private

Provided by the io module.

Defined in src/io/io.js:186

Adds 2 methods on the xhr-instance which are used by xhr when events occur:

xhr.onreadystatechange() xhr.ontimeout() // only XMLHttpRequest2

These events are responsible for making the Promise resolve.

Parameters:

  • xhr Object

    containing the xhr-instance

  • fulfill Function

    reference to the Promise fulfill-function

  • reject Function

    reference to the Promise reject-function

_setReadyHandle

(
  • xhr
  • fulfill
  • reject
)
private

Provided by the io module.

Defined in src/itsa-io/io.js:186

Adds 2 methods on the xhr-instance which are used by xhr when events occur:

xhr.onreadystatechange() xhr.ontimeout() // only XMLHttpRequest2

These events are responsible for making the Promise resolve.

Parameters:

  • xhr Object

    containing the xhr-instance

  • fulfill Function

    reference to the Promise fulfill-function

  • reject Function

    reference to the Promise reject-function

_setReadyHandle

(
  • xhr
  • fulfill
  • reject
)
private

Provided by the io module.

Defined in src/io kopie/io.js:186

Adds 2 methods on the xhr-instance which are used by xhr when events occur:

xhr.onreadystatechange() xhr.ontimeout() // only XMLHttpRequest2

These events are responsible for making the Promise resolve.

Parameters:

  • xhr Object

    containing the xhr-instance

  • fulfill Function

    reference to the Promise fulfill-function

  • reject Function

    reference to the Promise reject-function

_setStreamHeader

(
  • xhr
  • headers
  • method
)
private

Provided by the io-jsonp module.

Defined in src/itsa-io/extra/io-stream.js:118

Adds a headers X-Stream=true in case of a streaming request.

Parameters:

  • xhr Object

    containing the xhr-instance

  • headers Object

    containing all headers

  • method String

    the request-method used

_setStreamHeader

(
  • xhr
  • headers
  • method
)
private

Provided by the io-jsonp module.

Defined in src/io kopie/extra/io-stream.js:118

Adds a headers X-Stream=true in case of a streaming request.

Parameters:

  • xhr Object

    containing the xhr-instance

  • headers Object

    containing all headers

  • method String

    the request-method used

_setStreamHeader

(
  • xhr
  • headers
  • method
)
private

Provided by the io-jsonp module.

Defined in src/io/extra/io-stream.js:118

Adds a headers X-Stream=true in case of a streaming request.

Parameters:

  • xhr Object

    containing the xhr-instance

  • headers Object

    containing all headers

  • method String

    the request-method used

_toQueryString

(
  • data
)
String private

Provided by the io module.

Defined in src/io/io.js:237

Stringifies an object into one string with every pair separated by &

Parameters:

  • data Object

    containing key-value pairs

Returns:

String:

stringified presentation of the object, with every pair separated by &

_toQueryString

(
  • data
)
String private

Provided by the io module.

Defined in src/itsa-io/io.js:237

Stringifies an object into one string with every pair separated by &

Parameters:

  • data Object

    containing key-value pairs

Returns:

String:

stringified presentation of the object, with every pair separated by &

_toQueryString

(
  • data
)
String private

Provided by the io module.

Defined in src/io kopie/io.js:237

Stringifies an object into one string with every pair separated by &

Parameters:

  • data Object

    containing key-value pairs

Returns:

String:

stringified presentation of the object, with every pair separated by &

delete

(
  • url
  • deleteKey
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/itsa-io/extra/io-transfer.js:418

Performs an AJAX DELETE request. Shortcut for a call to xhr with method set to 'DELETE'.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: data should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • deleteKey Object

    Indentification of the id that has to be deleted. Typically an object like: {id: 12} This object will be passed as the request params.

  • [options] Object optional
    • [url] String optional

      The url to which the request is sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [params] Object optional

      Data to be sent to the server.

    • [body] Object optional

      The content for the request body for POST method.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object|String} any response you want the server to return. If the server send back a JSON-stringified object, it will be parsed to return as a full object You could set options.parseJSONDate true, it you want ISO8601-dates to be parsed as trully Date-objects on failure an Error object reason {Error}

delete

(
  • url
  • deleteKey
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io/extra/io-transfer.js:418

Performs an AJAX DELETE request. Shortcut for a call to xhr with method set to 'DELETE'.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: data should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • deleteKey Object

    Indentification of the id that has to be deleted. Typically an object like: {id: 12} This object will be passed as the request params.

  • [options] Object optional
    • [url] String optional

      The url to which the request is sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [params] Object optional

      Data to be sent to the server.

    • [body] Object optional

      The content for the request body for POST method.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object|String} any response you want the server to return. If the server send back a JSON-stringified object, it will be parsed to return as a full object You could set options.parseJSONDate true, it you want ISO8601-dates to be parsed as trully Date-objects on failure an Error object reason {Error}

delete

(
  • url
  • deleteKey
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io kopie/extra/io-transfer.js:418

Performs an AJAX DELETE request. Shortcut for a call to xhr with method set to 'DELETE'.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: data should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • deleteKey Object

    Indentification of the id that has to be deleted. Typically an object like: {id: 12} This object will be passed as the request params.

  • [options] Object optional
    • [url] String optional

      The url to which the request is sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [params] Object optional

      Data to be sent to the server.

    • [body] Object optional

      The content for the request body for POST method.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object|String} any response you want the server to return. If the server send back a JSON-stringified object, it will be parsed to return as a full object You could set options.parseJSONDate true, it you want ISO8601-dates to be parsed as trully Date-objects on failure an Error object reason {Error}

get

(
  • url
  • [params]
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io kopie/extra/io-transfer.js:112

Performs an AJAX GET request. Shortcut for a call to xhr with method set to 'GET'. Additional parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: params should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters. should be a plain object with only primitive types which are transformed into key/value pairs.

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [preventCache=false] Boolean optional

      whether to prevent caching --> a timestamp is added by parameter _ts

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: xhr {XMLHttpRequest|XDomainRequest} xhr-response on failure an Error object reason {Error}

get

(
  • url
  • [params]
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/itsa-io/extra/io-transfer.js:112

Performs an AJAX GET request. Shortcut for a call to xhr with method set to 'GET'. Additional parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: params should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters. should be a plain object with only primitive types which are transformed into key/value pairs.

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [preventCache=false] Boolean optional

      whether to prevent caching --> a timestamp is added by parameter _ts

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: xhr {XMLHttpRequest|XDomainRequest} xhr-response on failure an Error object reason {Error}

get

(
  • url
  • [params]
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io/extra/io-transfer.js:112

Performs an AJAX GET request. Shortcut for a call to xhr with method set to 'GET'. Additional parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: params should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters. should be a plain object with only primitive types which are transformed into key/value pairs.

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [preventCache=false] Boolean optional

      whether to prevent caching --> a timestamp is added by parameter _ts

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: xhr {XMLHttpRequest|XDomainRequest} xhr-response on failure an Error object reason {Error}

getCSS

(
  • url
  • [options]
)
Promise

Provided by the io-assets module.

Defined in src/itsa-io/extra/io-assets.js:38

Creates a <style> tag to load the CSS file at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

getCSS

(
  • url
  • [options]
)
Promise

Provided by the io-assets module.

Defined in src/io kopie/extra/io-assets.js:38

Creates a <style> tag to load the CSS file at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

getCSS

(
  • url
  • [options]
)
Promise

Provided by the io-assets module.

Defined in src/io/extra/io-assets.js:38

Creates a <style> tag to load the CSS file at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

getJS

(
  • url
  • [options]
)
Promise

Provided by the io-assets module.

Defined in src/io kopie/extra/io-assets.js:56

Creates a <script> tag to load the script at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

getJS

(
  • url
  • [options]
)
Promise

Provided by the io-assets module.

Defined in src/io/extra/io-assets.js:56

Creates a <script> tag to load the script at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

getJS

(
  • url
  • [options]
)
Promise

Provided by the io-assets module.

Defined in src/itsa-io/extra/io-assets.js:56

Creates a <script> tag to load the script at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

insert

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/itsa-io/extra/io-transfer.js:280

Performs an AJAX request with the POST HTTP method by default. When options.allfields is true, it will use the PUT-method: see Note2. The send data is an object which will be JSON-stringified before sending.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server. 'body.action' has the value 'insert'

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: The server needs to inspect the bodyparam: 'action', which always equals 'insert'. 'body.action' is the way to distinquish 'I.IO.insertObject' from 'I.IO.updateObject'. On purpose, we didn't make this distinction through a custom CONTENT-HEADER, because that would lead into a more complicated CORS-setup (see Note3) Note2: By default this method uses the POST-request: which is preferable if you don't know all the fields (like its unique id). if you send ALL the fields, set options.allfields=true. This will lead into using the PUT-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note3: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note4: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object | Promise

    Data to be sent, might be a Promise which resolves with the data-object.

  • [options] Object optional

    See also: I.io

    • [allfields=false] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object} usually, the final object-data, possibly modified, holding the key on failure an Error object reason {Error}

insert

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io/extra/io-transfer.js:280

Performs an AJAX request with the POST HTTP method by default. When options.allfields is true, it will use the PUT-method: see Note2. The send data is an object which will be JSON-stringified before sending.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server. 'body.action' has the value 'insert'

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: The server needs to inspect the bodyparam: 'action', which always equals 'insert'. 'body.action' is the way to distinquish 'I.IO.insertObject' from 'I.IO.updateObject'. On purpose, we didn't make this distinction through a custom CONTENT-HEADER, because that would lead into a more complicated CORS-setup (see Note3) Note2: By default this method uses the POST-request: which is preferable if you don't know all the fields (like its unique id). if you send ALL the fields, set options.allfields=true. This will lead into using the PUT-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note3: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note4: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object | Promise

    Data to be sent, might be a Promise which resolves with the data-object.

  • [options] Object optional

    See also: I.io

    • [allfields=false] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object} usually, the final object-data, possibly modified, holding the key on failure an Error object reason {Error}

insert

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io kopie/extra/io-transfer.js:280

Performs an AJAX request with the POST HTTP method by default. When options.allfields is true, it will use the PUT-method: see Note2. The send data is an object which will be JSON-stringified before sending.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server. 'body.action' has the value 'insert'

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: The server needs to inspect the bodyparam: 'action', which always equals 'insert'. 'body.action' is the way to distinquish 'I.IO.insertObject' from 'I.IO.updateObject'. On purpose, we didn't make this distinction through a custom CONTENT-HEADER, because that would lead into a more complicated CORS-setup (see Note3) Note2: By default this method uses the POST-request: which is preferable if you don't know all the fields (like its unique id). if you send ALL the fields, set options.allfields=true. This will lead into using the PUT-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note3: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note4: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object | Promise

    Data to be sent, might be a Promise which resolves with the data-object.

  • [options] Object optional

    See also: I.io

    • [allfields=false] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object} usually, the final object-data, possibly modified, holding the key on failure an Error object reason {Error}

read

(
  • url
  • [params]
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io kopie/extra/io-transfer.js:161

Performs an AJAX request with the GET HTTP method and expects a JSON-object. The resolved Promise-callback returns an object (JSON-parsed serverresponse).

Additional request-parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: If you expect the server to response with data that consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects. Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters.

  • [options] Object optional

    See also: I.io can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [parseProto] Object optional

      to set the prototype of any object.

    • [parseProtoCheck] Function optional

      to determine in what case the specified parseProto should be set as the prototype. The function accepts the object as argument and should return a trully value in order to set the prototype. When not specified, parseProto will always be applied (if parseProtois defined)

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: Object received data on failure an Error object reason {Error}

read

(
  • url
  • [params]
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io/extra/io-transfer.js:161

Performs an AJAX request with the GET HTTP method and expects a JSON-object. The resolved Promise-callback returns an object (JSON-parsed serverresponse).

Additional request-parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: If you expect the server to response with data that consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects. Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters.

  • [options] Object optional

    See also: I.io can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [parseProto] Object optional

      to set the prototype of any object.

    • [parseProtoCheck] Function optional

      to determine in what case the specified parseProto should be set as the prototype. The function accepts the object as argument and should return a trully value in order to set the prototype. When not specified, parseProto will always be applied (if parseProtois defined)

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: Object received data on failure an Error object reason {Error}

read

(
  • url
  • [params]
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/itsa-io/extra/io-transfer.js:161

Performs an AJAX request with the GET HTTP method and expects a JSON-object. The resolved Promise-callback returns an object (JSON-parsed serverresponse).

Additional request-parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: If you expect the server to response with data that consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects. Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters.

  • [options] Object optional

    See also: I.io can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [parseProto] Object optional

      to set the prototype of any object.

    • [parseProtoCheck] Function optional

      to determine in what case the specified parseProto should be set as the prototype. The function accepts the object as argument and should return a trully value in order to set the prototype. When not specified, parseProto will always be applied (if parseProtois defined)

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: Object received data on failure an Error object reason {Error}

readObjectJSONP

(
  • url
  • [options]
)
Promise

Provided by the io-jsonp module.

Defined in src/io kopie/extra/io-jsonp.js:36

Creates a <style> tag to load the CSS file at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

readObjectJSONP

(
  • url
  • [options]
)
Promise

Provided by the io-jsonp module.

Defined in src/itsa-io/extra/io-jsonp.js:36

Creates a <style> tag to load the CSS file at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

readObjectJSONP

(
  • url
  • [options]
)
Promise

Provided by the io-jsonp module.

Defined in src/io/extra/io-jsonp.js:36

Creates a <style> tag to load the CSS file at the given url.

Parameters:

  • url String

    URL of the style sheet to load

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

readXML

(
  • url
  • [params]
  • [options]
)
Promise

Performs an AJAX request with the GET HTTP method and expects a JSON-object. The resolved Promise-callback returns an object (JSON-parsed serverresponse).

Additional request-parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: If you expect the server to response with data that consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects. Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters.

  • [options] Object optional

    See also: I.io

    • [url] String optional

      The url to which the request is sent. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [params] Object optional

      Data to be sent to the server.

    • [body] Object optional

      The content for the request body for POST method.

    • [headers] Object optional

      HTTP request headers.

    • [responseType='text'] String optional

      The response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

Returns:

Promise:

on success: Object received data on failure an Error object reason {Error}

readXML

(
  • url
  • [params]
  • [options]
)
Promise

Performs an AJAX request with the GET HTTP method and expects a JSON-object. The resolved Promise-callback returns an object (JSON-parsed serverresponse).

Additional request-parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: If you expect the server to response with data that consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects. Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters.

  • [options] Object optional

    See also: I.io

    • [url] String optional

      The url to which the request is sent. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [params] Object optional

      Data to be sent to the server.

    • [body] Object optional

      The content for the request body for POST method.

    • [headers] Object optional

      HTTP request headers.

    • [responseType='text'] String optional

      The response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

Returns:

Promise:

on success: Object received data on failure an Error object reason {Error}

readXML

(
  • url
  • [params]
  • [options]
)
Promise

Performs an AJAX request with the GET HTTP method and expects a JSON-object. The resolved Promise-callback returns an object (JSON-parsed serverresponse).

Additional request-parameters can be on the url (with questionmark), through params, or both.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: If you expect the server to response with data that consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects. Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/

Parameters:

  • url String

    URL of the resource server

  • [params] Object optional

    additional parameters.

  • [options] Object optional

    See also: I.io

    • [url] String optional

      The url to which the request is sent. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [params] Object optional

      Data to be sent to the server.

    • [body] Object optional

      The content for the request body for POST method.

    • [headers] Object optional

      HTTP request headers.

    • [responseType='text'] String optional

      The response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

Returns:

Promise:

on success: Object received data on failure an Error object reason {Error}

request

(
  • options
)
Promise

Provided by the io module.

Defined in src/io/io.js:258

Sends a HTTP request to the server and returns a Promise with an additional .abort() method to cancel the request. This method is the standard way of doing xhr-requests without processing streams.

Parameters:

  • options Object
    • [url] String optional

      The url to which the request is sent.

    • [method='GET'] String optional

      The HTTP method to use. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [data] Object optional

      Data to be sent to the server, either to be used by query-params or body.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [streamback] Function optional

      callbackfunction in case you want to process streams (needs io-stream module).

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

request

(
  • options
)
Promise

Provided by the io module.

Defined in src/io kopie/io.js:258

Sends a HTTP request to the server and returns a Promise with an additional .abort() method to cancel the request. This method is the standard way of doing xhr-requests without processing streams.

Parameters:

  • options Object
    • [url] String optional

      The url to which the request is sent.

    • [method='GET'] String optional

      The HTTP method to use. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [data] Object optional

      Data to be sent to the server, either to be used by query-params or body.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [streamback] Function optional

      callbackfunction in case you want to process streams (needs io-stream module).

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

request

(
  • options
)
Promise

Provided by the io module.

Defined in src/itsa-io/io.js:258

Sends a HTTP request to the server and returns a Promise with an additional .abort() method to cancel the request. This method is the standard way of doing xhr-requests without processing streams.

Parameters:

  • options Object
    • [url] String optional

      The url to which the request is sent.

    • [method='GET'] String optional

      The HTTP method to use. can be ignored, even if streams are used --> the returned Promise will always hold all data

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [data] Object optional

      Data to be sent to the server, either to be used by query-params or body.

    • [headers] Object optional

      HTTP request headers.

    • [responseType] String optional

      Force the response type.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [streamback] Function optional

      callbackfunction in case you want to process streams (needs io-stream module).

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

Promise holding the request. Has an additional .abort() method to cancel the request.

  • on success: xhr {XMLHttpRequest1|XMLHttpRequest2} xhr-response
  • on failure: reason {Error}

send

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/itsa-io/extra/io-transfer.js:329

Performs an AJAX request with the PUT HTTP method by default. When options.allfields is false, it will use the POST-method: see Note2. The send data is an object which will be JSON-stringified before sending.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: By default this method uses the PUT-request: which is preferable is you send the WHOLE object. if you send part of the fields, set options.allfields=false. This will lead into using the POST-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note3: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object

    Data to be sent.

  • [options] Object optional

    See also: I.io

    • [allfields=true] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object|String} any response you want the server to return. If the server send back a JSON-stringified object, it will be parsed to return as a full object You could set options.parseJSONDate true, it you want ISO8601-dates to be parsed as trully Date-objects on failure an Error object reason {Error}

send

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io kopie/extra/io-transfer.js:329

Performs an AJAX request with the PUT HTTP method by default. When options.allfields is false, it will use the POST-method: see Note2. The send data is an object which will be JSON-stringified before sending.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: By default this method uses the PUT-request: which is preferable is you send the WHOLE object. if you send part of the fields, set options.allfields=false. This will lead into using the POST-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note3: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object

    Data to be sent.

  • [options] Object optional

    See also: I.io

    • [allfields=true] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object|String} any response you want the server to return. If the server send back a JSON-stringified object, it will be parsed to return as a full object You could set options.parseJSONDate true, it you want ISO8601-dates to be parsed as trully Date-objects on failure an Error object reason {Error}

send

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io/extra/io-transfer.js:329

Performs an AJAX request with the PUT HTTP method by default. When options.allfields is false, it will use the POST-method: see Note2. The send data is an object which will be JSON-stringified before sending.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: By default this method uses the PUT-request: which is preferable is you send the WHOLE object. if you send part of the fields, set options.allfields=false. This will lead into using the POST-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note2: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note3: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object

    Data to be sent.

  • [options] Object optional

    See also: I.io

    • [allfields=true] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object|String} any response you want the server to return. If the server send back a JSON-stringified object, it will be parsed to return as a full object You could set options.parseJSONDate true, it you want ISO8601-dates to be parsed as trully Date-objects on failure an Error object reason {Error}

sendBlob

(
  • url
  • blob
  • [params]
  • [options]
)
Promise

Provided by the io-filetransfer module.

Defined in src/itsa-io/extra/io-filetransfer.js:130

Sends a blob by using an AJAX PUT request. Additional parameters can be through the params argument.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: params should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • blob Blob

    blob (data) representing the file to be send. Typically HTMLInputElement.files[0]

  • [params] Object optional

    additional parameters. NOTE: this object will be stringified set a HEADER: x-data on the request! should be a plain object with only primitive types which are transformed into key/value pairs.

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=300000] Number optional

      to timeout the request, leading into a rejected Promise. Defaults to 5 minutes

    • [progressfn] Function optional

      callbackfunction in case you want to process upload-status. Function has 3 parameters: total, loaded and target (io-promise)

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: Object any received data on failure an Error object reason {Error}

sendBlob

(
  • url
  • blob
  • [params]
  • [options]
)
Promise

Provided by the io-filetransfer module.

Defined in src/io kopie/extra/io-filetransfer.js:130

Sends a blob by using an AJAX PUT request. Additional parameters can be through the params argument.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: params should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • blob Blob

    blob (data) representing the file to be send. Typically HTMLInputElement.files[0]

  • [params] Object optional

    additional parameters. NOTE: this object will be stringified set a HEADER: x-data on the request! should be a plain object with only primitive types which are transformed into key/value pairs.

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=300000] Number optional

      to timeout the request, leading into a rejected Promise. Defaults to 5 minutes

    • [progressfn] Function optional

      callbackfunction in case you want to process upload-status. Function has 3 parameters: total, loaded and target (io-promise)

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: Object any received data on failure an Error object reason {Error}

sendBlob

(
  • url
  • blob
  • [params]
  • [options]
)
Promise

Provided by the io-filetransfer module.

Defined in src/io/extra/io-filetransfer.js:130

Sends a blob by using an AJAX PUT request. Additional parameters can be through the params argument.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note: params should be a plain object with only primitive types which are transformed into key/value pairs.

Parameters:

  • url String

    URL of the resource server

  • blob Blob

    blob (data) representing the file to be send. Typically HTMLInputElement.files[0]

  • [params] Object optional

    additional parameters. NOTE: this object will be stringified set a HEADER: x-data on the request! should be a plain object with only primitive types which are transformed into key/value pairs.

  • [options] Object optional
    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=300000] Number optional

      to timeout the request, leading into a rejected Promise. Defaults to 5 minutes

    • [progressfn] Function optional

      callbackfunction in case you want to process upload-status. Function has 3 parameters: total, loaded and target (io-promise)

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: Object any received data on failure an Error object reason {Error}

update

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/itsa-io/extra/io-transfer.js:231

Sends data (object) which will be JSON-stringified before sending. Performs an AJAX request with the PUT HTTP method by default. When options.allfields is false, it will use the POST-method: see Note2.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: The server needs to inspect the bodyparam: 'action', which always equals 'update'. 'body.action' is the way to distinquish 'I.IO.updateObject' from 'I.IO.insertObject'. On purpose, we didn't make this distinction through a custom CONTENT-HEADER, because that would lead into a more complicated CORS-setup (see Note3) Note2: By default this method uses the PUT-request: which is preferable is you send the WHOLE object. if you send part of the fields, set options.allfields=false. This will lead into using the POST-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note3: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note4: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object | Promise

    Data to be sent, might be a Promise which resolves with the data-object.

  • [options] Object optional

    See also: I.io

    • [allfields=true] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object} usually, the final object-data, possibly modified on failure an Error object reason {Error}

update

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io/extra/io-transfer.js:231

Sends data (object) which will be JSON-stringified before sending. Performs an AJAX request with the PUT HTTP method by default. When options.allfields is false, it will use the POST-method: see Note2.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: The server needs to inspect the bodyparam: 'action', which always equals 'update'. 'body.action' is the way to distinquish 'I.IO.updateObject' from 'I.IO.insertObject'. On purpose, we didn't make this distinction through a custom CONTENT-HEADER, because that would lead into a more complicated CORS-setup (see Note3) Note2: By default this method uses the PUT-request: which is preferable is you send the WHOLE object. if you send part of the fields, set options.allfields=false. This will lead into using the POST-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note3: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note4: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object | Promise

    Data to be sent, might be a Promise which resolves with the data-object.

  • [options] Object optional

    See also: I.io

    • [allfields=true] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object} usually, the final object-data, possibly modified on failure an Error object reason {Error}

update

(
  • url
  • data
  • [options]
)
Promise

Provided by the io-transfer module.

Defined in src/io kopie/extra/io-transfer.js:231

Sends data (object) which will be JSON-stringified before sending. Performs an AJAX request with the PUT HTTP method by default. When options.allfields is false, it will use the POST-method: see Note2.

The 'content-type' of the header is set to 'application/json', overruling manually options.

'data' is send as 'body.data' and should be JSON-parsed at the server.

The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204). It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.

Note1: The server needs to inspect the bodyparam: 'action', which always equals 'update'. 'body.action' is the way to distinquish 'I.IO.updateObject' from 'I.IO.insertObject'. On purpose, we didn't make this distinction through a custom CONTENT-HEADER, because that would lead into a more complicated CORS-setup (see Note3) Note2: By default this method uses the PUT-request: which is preferable is you send the WHOLE object. if you send part of the fields, set options.allfields=false. This will lead into using the POST-method. More about HTTP-methods: https://stormpath.com/blog/put-or-post/ Note3: CORS is supported, as long as the responseserver is set up to: a) has a response header which allows the clientdomain: header('Access-Control-Allow-Origin: http://www.some-site.com'); or header('Access-Control-Allow-Origin: *'); b) in cae you have set a custom HEADER (through 'options'), the responseserver MUST listen and respond to requests with the OPTION-method More info: allows to send to your domain: see http://remysharp.com/2011/04/21/getting-cors-working/ Note4: If the server response JSON-stringified data, the Promise resolves with a JS-Object. If you expect this object to consist of Date-properties, you should set options.parseJSONDate true. Parsing takes a bit longer, but it will generate trully Date-objects.

Parameters:

  • url String

    URL of the resource server

  • data Object | Promise

    Data to be sent, might be a Promise which resolves with the data-object.

  • [options] Object optional

    See also: I.io

    • [allfields=true] Boolean optional

      to specify that all the object-fields are sent.

    • [sync=false] Boolean optional

      By default, all requests are sent asynchronously. To send synchronous requests, set to true.

    • [headers] Object optional

      HTTP request headers.

    • [timeout=3000] Number optional

      to timeout the request, leading into a rejected Promise.

    • [withCredentials=false] Boolean optional

      Whether or not to send credentials on the request.

    • [parseJSONDate=false] Boolean optional

      Whether the server returns JSON-stringified data which has Date-objects.

    • [stayActive] Number optional

      minimal time the request should be pending, even if IO has finished

Returns:

Promise:

on success: response {Object} usually, the final object-data, possibly modified on failure an Error object reason {Error}