Syncer

Skull. Syncer

new Syncer(options)

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
emulateHTTP Boolean <optional>
false

emulate HTTP 1.1 methods for old servers

emulateJSON Boolean <optional>
false

emulate JSON by encoding the request into an HTML-form

authHeaderName String <optional>
'Authorization'

Use this header to pass authorization token

registry Skull.ResourceRegistry

registry instance

Source:

Members

(protected) _methodMap

Map from CRUD operations to HTTP verbs for default syncer implementation.

Source:

Methods

(protected) _authorize(params) → {Object}

Augments request params with authorization header. Feel free to override with your logic.

Parameters:
Name Type Description
params Object
Source:
Returns:

augmented request params

Type
Object

(protected) _urlError()

Source:

ajax() → {jQuery.Deferred}

Performs ajax request

Source:
Returns:
Type
jQuery.Deferred

sync(method, model, optionsopt) → {jQuery.Deferred}

Pretty much the same as Backbone.sync, only allows to extend requests with authorization headers

Parameters:
Name Type Attributes Default Description
method String
model Backbone.Model | Backbone.Collection
options Object <optional>
{}

Allows to override any request param

Source:
Returns:
Type
jQuery.Deferred

Skull. Syncer

new Syncer()

Backbone.sync OOP-style Can emit authorized requests, when provided with getToken function via registry

Source:

Members

(protected) _methodMap

Map from CRUD operations to HTTP verbs for default syncer implementation.

Source:

Methods

(protected) _authorize(params) → {Object}

Augments request params with authorization header. Feel free to override with your logic.

Parameters:
Name Type Description
params Object
Source:
Returns:

augmented request params

Type
Object

(protected) _urlError()

Source:

ajax() → {jQuery.Deferred}

Performs ajax request

Source:
Returns:
Type
jQuery.Deferred

sync(method, model, optionsopt) → {jQuery.Deferred}

Pretty much the same as Backbone.sync, only allows to extend requests with authorization headers

Parameters:
Name Type Attributes Default Description
method String
model Backbone.Model | Backbone.Collection
options Object <optional>
{}

Allows to override any request param

Source:
Returns:
Type
jQuery.Deferred