Skip to content

Module: core::NetworkRequest

Jovan Gerodetti edited this page Apr 14, 2021 · 5 revisions

NetworkRequest

exported: default
kind: object
declaration: const

A network request

Properties

🚫 _body

Type: object
kind: object

🚫 _headers

Type: object
kind: value

type

Type: string
kind: value

method

Type: string
kind: value

url

Type: string
kind: value

🚫 _listeners

Type: Array.<Function>
kind: value

completed

Type: boolean
kind: value

indicator flag whether or not the request is completed

promise

Type: Promise
kind: value

__proto__

Type: EventTarget
kind: value

Methods

constructor(url, config, config.method, config.type) => {NetworkRequest}

kind: function

The constructor for the NetworkRequest. It simply sets up the properties.

Name Type Description
url string the url this request should be made to
config object addintional configuartion for the request
config.method string
config.type string

_make(args) => {void}

kind: function

use the constructor
[_make description]

Name Type Description
args Array [description]

body(data) => {NetworkRequest}

kind: function

this method will set the given object as the request body.

Name Type Description
data object body data for this request

headers(headers) => {NetworkRequest}

kind: function

This method will set the request headers, in case custom headers are required.

Name Type Description
headers object a object with all header properties for this request

setHeader(key, value) => {NetworkRequest}

kind: function

Sets a single header for this request.

Name Type Description
key string the header key
value string the header value

onReady(fn) => {void}

kind: function

sets a callback for when the request is ready

Name Type Description
fn Function a callback function as soon as the data is ready

send() => {Promise}

kind: function

This will actually create the network connection and initiate the request.

cancel() => {undefined}

kind: function

cancels an already sent request.

Clone this wiki locally