AppState
This is the transient application state, not persisted on Parse. By using a Backbone.Model
this also makes it an
instance of Backbone.Events
allowing subscription to state changes. Exporting an instance of AppState allows
any other module to import this instance.
Member Summary
Public Members | ||
public get |
Sets the |
|
public get |
Returns the default values for AppState which is set in |
Inherited Summary
From class Events | ||
public |
bind(): * Delegates to |
|
public |
Tell an object to listen to a particular event on an other object. |
|
public |
listenToOnce(obj: object, name: string, callback: function): Events Just like |
|
public |
Remove a previously-bound callback function from an object. |
|
public |
Bind a callback function to an object. |
|
public |
Just like |
|
public |
stopListening(obj: object, name: string, callback: function): Events Tell an object to stop listening to events. |
|
public |
Trigger callbacks for the given event, or space-delimited list of events. |
|
public |
unbind(): * Delegates to |
From class Model | ||
public |
The hash of attributes for this model. |
|
public |
A hash of attributes whose current and previous value differ. |
|
public |
Client side ID |
|
public |
The prefix is used to create the client id which is used to identify models locally. |
|
public |
A potentially associated collection. |
|
public |
id: * Update the |
|
public |
The value returned during the last failed validation. |
|
public |
changedAttributes(diff: object): object | boolean Retrieve a hash of only the model's attributes that have changed since the last set, or false if there are none. Optionally, an external attributes hash can be passed in, returning the attributes in that hash which differ from the model. This can be used to figure out which portions of a view should be updated, or what calls need to be made to sync the changes to the server. |
|
public |
Removes all attributes from the model, including the id attribute. |
|
public |
clone(): * Returns a new instance of the model with identical attributes. |
|
public |
destroy(options: object): boolean | XMLHttpRequest Destroys the model on the server by delegating an HTTP DELETE request to Backbone.sync. |
|
public |
Similar to get, but returns the HTML-escaped version of a model's attribute. If you're interpolating data from the model into HTML, using escape to retrieve attributes will prevent XSS attacks. |
|
public |
Merges the model's state with attributes fetched from the server by delegating to Backbone.sync. Returns a jqXHR. Useful if the model has never been populated with data, or if you'd like to ensure that you have the latest server state. |
|
public |
get(attr: *): * Get the current value of an attribute from the model. |
|
public |
Returns true if the attribute is set to a non-null or non-undefined value. |
|
public |
hasChanged(attr: string): * Has the model changed since its last set? If an attribute is passed, returns true if that specific attribute has changed. |
|
public abstract |
Initialize is an empty function by default. |
|
public |
Has this model been saved to the server yet? If the model does not yet have an id, it is considered to be new. |
|
public |
Run validate to check the model state. |
|
public |
Special-cased proxy to the |
|
public |
parse is called whenever a model's data is returned by the server, in fetch, and save. The function is passed the raw response object, and should return the attributes hash to be set on the model. The default implementation is a no-op, simply passing through the JSON response. Override this if you need to work with a preexisting API, or better namespace your responses. |
|
public |
During a "change" event, this method can be used to get the previous value of a changed attribute. |
|
public |
previousAttributes(): * Return a copy of the model's previous attributes. Useful for getting a diff between versions of a model, or getting back to a valid state after an error occurs. |
|
public |
Save a model to your database (or alternative persistence layer), by delegating to Backbone.sync. |
|
public |
Set a hash of attributes (one or many) on the model. |
|
public |
sync(): * Uses Backbone.sync to persist the state of a model to the server. |
|
public |
Return a shallow copy of the model's attributes for JSON stringification. This can be used for persistence, serialization, or for augmentation before being sent to the server. The name of this method is a bit confusing, as it doesn't actually return a JSON string — but I'm afraid that it's the way that the JavaScript API for JSON.stringify works. |
|
public |
Remove an attribute by deleting it from the internal attributes hash. |
|
public |
Returns the relative URL where the model's resource would be located on the server. If your models are located somewhere else, override this method with the correct logic. Generates URLs of the form: "[collection.url]/[id]" by default, but you may override by specifying an explicit urlRoot if the model's collection shouldn't be taken into account. Delegates to Collection#url to generate the URL, so make sure that you have it defined, or a urlRoot property, if all models of this class share a common root URL. A model with an id of 101, stored in a Backbone.Collection with a url of "/documents/7/notes", would have this URL: "/documents/7/notes/101" |
|
protected |
Run validation against the next complete set of model attributes, returning |