Class: Factory

Factory

new Factory()

The base factory class

Source:

Members

collectionTransformer :function

The transformer to be run on a collection (array)

Type:
  • function
Source:

config :Object

The configuration

Type:
  • Object
Source:

elementTransformer :function

The transformer to be run on each element

Type:
  • function
Source:

route :String

The route

Type:
  • String
Source:

Methods

(static) create(element, fromServeropt) → {Element}

Creates an element

Parameters:
Name Type Attributes Default Description
element object

The element to create

fromServer Boolean <optional>
false

Whether this element is from the server or not

Source:
Returns:
Type
Element

(static) customPOST(paramsopt, route=opt) → {Promise.<xhr.response>}

Make a post request

Parameters:
Name Type Attributes Default Description
params Object <optional>
{}

The URL parameters for the request

route= String <optional>

A custom route for the request

Source:
Returns:

The request promise

Type
Promise.<xhr.response>

(static) get(id, paramsopt) → {Promise.<xhr.response>}

Make a get request for a given id

Parameters:
Name Type Attributes Default Description
id Integer

The id of the element to fetch from the server

params Object <optional>
{}

The URL parameters for the request

Source:
Returns:

The request promise

Type
Promise.<xhr.response>

(static) getList(paramsopt) → {Promise.<xhr.response>}

Makes a request to the server for an array

Parameters:
Name Type Attributes Default Description
params Object <optional>
{}

The URL parameters for the request

Source:
Returns:

The request promise

Type
Promise.<xhr.response>

(static) post(paramsopt, route=opt) → {Promise.<xhr.response>}

Make a post request

Parameters:
Name Type Attributes Default Description
params Object <optional>
{}

The URL parameters for the request

route= String <optional>

A custom route for the request

Source:
Returns:

The request promise

Type
Promise.<xhr.response>