Class: ExtendedApi

ExtendedApi

new ExtendedApi()

Provides a common framework on top of the RecordApi and CollectionApi.

Properties:
Name Type Description
$resolved boolean

The collection resolve status, is undefined on intialization

Source:
  • module/api/extended-api.js, line 5

Methods

$refresh(_params) → {ExtendedApi}

Resets and fetches the resource contents.

Parameters:
Name Type Description
_params object

$fetch params

Source:
  • module/api/extended-api.js, line 116
Returns:

self

Type
ExtendedApi

$reset() → {ExtendedApi}

Resets the resource's $resolved status.

After being reset, calls to $resolve will execute a new $fetch.

Also, if reset, resource will be cleared on new data.

Source:
  • module/api/extended-api.js, line 80
Returns:

self

Type
ExtendedApi

$resolve(_params) → {promise}

Resolves the resource's contents.

If already resolved then this method will return a resolved promise, if not then it will initiate a $fetch operation and return the operation promise.

This method will trigger a before-resolve event before checking the resolve status.

Parameters:
Name Type Description
_params object

$fetch params

Source:
  • module/api/extended-api.js, line 101
Returns:

Promise that resolves to the resource.

Type
promise

$unwrap(_raw, _mask) → {ExtendedApi}

Unpacks and decode raw data from a server generated structure.

ATTENTION: do not override this method to change the object wrapping strategy, instead, override the static Model.$unpack method.

Parameters:
Name Type Description
_raw mixed

Raw server data

_mask string

'CRU' mask

Source:
  • module/api/extended-api.js, line 40
Returns:

this

Type
ExtendedApi

$wrap(_mask) → {string}

Encode and packs object into a server compatible structure that can be used for PUT/POST operations.

ATTENTION: do not override this method to change the object wrapping strategy, instead, override the static Model.$pack method.

Parameters:
Name Type Description
_mask string

'CRU' mask

Source:
  • module/api/extended-api.js, line 63
Returns:

raw data

Type
string