Skip to content

Instantly share code, notes, and snippets.

@lholmquist
Created November 6, 2013 18:28
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lholmquist/7341532 to your computer and use it in GitHub Desktop.
//this is using promises.
dm.stores.demo.open().then( function( value ) {
var data = [
{
"id": 1,
"name": "Lea",
"type": "Skywalker"
}
];
dm.stores.demo.save( data );
start(); //this tells the test to keep going since it async
});
//The same thing using callbacks
dm.stores.demo.open({
success: function() {
var data = [
{
"id": 1,
"name": "Lea",
"type": "Skywalker"
}
];
dm.stores.demo.save( data );
start();
},
error: function() {
//error stuff
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment