Item
Extends:
Our basic todos Item model has content
, order
, and done
attributes. When creating a new Item instance in
App.js->createItem
the current Parse user is also associated with the item instance along with a
Parse.ACL (access control list) instance which ensures that the item is only accessible by that given user.
Member Summary
Public Members | ||
public get |
Returns the |
|
public get |
Default attributes for the item. |
Method Summary
Public Methods | ||
public |
Ensure that each item created has |
|
public |
toggle() Toggle the |
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 |
From class ParseModel | ||
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 |
Parse class name |
|
public |
A potentially associated collection. |
|
public |
id: * Update the |
|
public |
Parse proxy ParseObject |
|
public |
Object hash of name / class to register as sub classes. |
|
public |
The value returned during the last failed validation. |
|
public |
clone(): * Returns a new instance of the model with identical attributes. |
|
public |
Destroys the model on the server by delegating delete request to Backbone.sync and the associated ParseObject. |
|
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 |
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. This implementation
requires a ParseObject and the attributes are directly taken from the attributes of the ParseObject. To keep
parity with the Parse SDK the ID of the ParseObject is set as |
|
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 and potentially on the associated ParseObject. |
|
public |
Return a copy of the model's |
|
public |
url() This is an unsupported operation for backbone-parse-es6. |
Public Members
public get className: string: string source
Returns the className
which is the table stored in Parse.