Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==========================================================================
- // StoreTest
- // ==========================================================================
- StoreTest = SC.Object.create({
- // Configure the way you want your data stored here
- store: SC.store().from(SC.LocalStorage).from(
- SC.AtomRestAdaptor.create({ only: '/tasks', format: SC.JSON_FORMAT }),
- SC.AtomRestAdaptor.create({ only: '/session', format: SC.XML_FORMAT }));
- // When you are in development mode, this array will be populated with
- // any fixtures you create for testing and loaded automatically in your
- // main method. When in production, this will be an empty array.
- FIXTURES: []
- }) ;
- // creating an editing context is the same thing...
- var context = SC.EditingContext.create().from(Todos.store);
- or
- var context = Todos.store.newEditingContext() ;
- // you can commit a context and all changed records will commit...
- context.commitChanges() ;
- // or you can discard changes and the context will refresh any records from
- // their data source.
- context.discardChanges() ;
- context.recordDidChange() // invoke whenever a record changes.
- context.isDirty // changes whenever a record has changed.
- //---
- /** Request that the source context load the attributes for the specified
- query options.
- */
- loadRecordsForContext: function(context, params) ;
- refreshRecordsForContext: function(context, records) ;
- updateRecordsFromSourceContext: function(dataHashes, sourceContext) ;
- /** Request that the source context take the updated attributes for the named
- record. */
- commitRecordsForContext: function(context, records) ;
- //callback
- commitRecordsDidSucceedForSourceContext: function(sourceContext, records) ;
- commitRecordsDidFailForSourceContext: function(sourceContext, records) ;
- /** Request that the source context create new set of attributes for the
- record. It should invoke a callback on the context when complete to set a
- permenant guid. */
- createRecordsForContext: function(context, records) ;
- createRecordsDidSucceedForSourceContext: function(sourceContext, records) ;
- createRecordsDidFailForSourceContext: function(sourceContext, records) ;
- /** Request that the source context delete the attributes associated with the
- passed records. It should invoke a callback o nthe context when complete.
- */
- destroyRecordsForContext: function(context, records) ;
- destroyRecordsDidSucceedForSourceContext: function(sourceContext, records) ;
- destroyRecordsDidFailForSourceContext: function(sourceContext, records) ;
Add Comment
Please, Sign In to add comment