Home Reference Source Repository

Function

Static Public Summary
public

extend(protoProps: object, staticProps: object): *

Provides older "extend" functionality for Backbone.

public

modelExtend(className: string | object, protoProps: object, staticProps: object): *

Provides extend functionality for Model that is compatible to the Parse SDK.

public

parseExtend(Backbone: Backbone)

Provides support for older "extend" functionality in addition to adding a utility method, "getHTTPSUrl" to retrieve an HTTPS url for Parse.Object and Backbone.Model.

public

parseSync(method: string, model: Model | Collection, options: object): * | ParsePromise

parseSync - Persists models to the server.

public

sync(method: string, model: Model | Collection, options: object): XMLHttpRequest

Backbone.sync - Persists models to the server.

Static Public

public extend(protoProps: object, staticProps: object): * source

import extend from 'backbone-es6/src/extend.js'

Provides older "extend" functionality for Backbone. While it is still accessible it is recommended to adopt the new Backbone-ES6 patterns and ES6 sub-classing via "extends".

Helper function to correctly set up the prototype chain for subclasses. Similar to goog.inherits, but uses a hash of prototype properties and class properties to be extended.

Params:

NameTypeAttributeDescription
protoProps object

instance properties

staticProps object

class properties

Return:

*

Subclass of parent class.

See:

public modelExtend(className: string | object, protoProps: object, staticProps: object): * source

import modelExtend from 'backbone-parse-es6/src/modelExtend.js'

Provides extend functionality for Model that is compatible to the Parse SDK.

Params:

NameTypeAttributeDescription
className string | object

Class name or object hash w/ className key

protoProps object

instance properties

staticProps object

class properties

Return:

*

Subclass of parent class.

public parseExtend(Backbone: Backbone) source

import parseExtend from 'backbone-parse-es6/src/parseExtend.js'

Provides support for older "extend" functionality in addition to adding a utility method, "getHTTPSUrl" to retrieve an HTTPS url for Parse.Object and Backbone.Model.

Params:

NameTypeAttributeDescription
Backbone Backbone

Backbone instance

public parseSync(method: string, model: Model | Collection, options: object): * | ParsePromise source

import parseSync from 'backbone-parse-es6/src/parseSync.js'

parseSync - Persists models to the server. (http://backbonejs.org/#Sync)

This version of sync uses Parse 1.6+ and ParseObject for Backbone.Model or Parse.Query for Backbone.Collections. You will be passed back a ParsePromise and can use it in a similar manner as one would with Parse SDK itself.

Dispatches to Model or Collection sync methods.

Params:

NameTypeAttributeDescription
method string

A string that defines the synchronization action to perform.

model Model | Collection

The model or collection instance to synchronize.

options object

Optional parameters.

Return:

* | ParsePromise

public sync(method: string, model: Model | Collection, options: object): XMLHttpRequest source

import sync from 'backbone-es6/src/sync.js'

Backbone.sync - Persists models to the server. (http://backbonejs.org/#Sync)

Override this function to change the manner in which Backbone persists models to the server. You will be passed the type of request, and the model in question. By default, makes a RESTful Ajax request to the model's url(). Some possible customizations could be:

Use setTimeout to batch rapid-fire updates into a single request. Send up the models as XML instead of JSON. Persist models via WebSockets instead of Ajax.

Turn on Backbone.emulateHTTP in order to send PUT and DELETE requests as POST, with a _method parameter containing the true HTTP method, as well as all requests with the body as application/x-www-form-urlencoded instead of application/json with the model in a param named model. Useful when interfacing with server-side languages like PHP that make it difficult to read the body of PUT requests.

Params:

NameTypeAttributeDescription
method string

A string that defines the synchronization action to perform.

model Model | Collection

The model or collection instance to synchronize.

options object

Optional parameters

Return:

XMLHttpRequest

An XMLHttpRequest