Created
November 6, 2013 18:28
-
-
Save lholmquist/7341532 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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