Created
February 28, 2014 09:34
-
-
Save daleharvey/9268112 to your computer and use it in GitHub Desktop.
This file contains 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
// My code | |
editPlace: function(url, fun) { | |
var self = this; | |
var rev = this.dataStore.revisionId; | |
return new Promise(function(resolve) { | |
self.dataStore.get(url).then(function(place) { | |
fun(place, function(newPlace) { | |
console.log('ATTEMPTING TO SAVE', self.dataStore.revisionId, rev); | |
if (self.dataStore.revisionId !== rev) { | |
console.log('DENIED'); | |
return self.editPlace(url, fun); | |
} | |
self.dataStore.put(newPlace, url, rev).then(function() { | |
console.log('I SAVED', self.dataStore.revisionId); | |
console.log(JSON.stringify(newPlace)); | |
resolve(); | |
}); | |
}); | |
}); | |
}); | |
}, | |
// My log | |
[marionette log] SAVING VISIT | |
[marionette log] UPDATING VISIT | |
[marionette log] ATTEMPTING TO SAVE {70d7bd91-b3ca-ef46-bc63-89bdf1a8baa1} {70d7bd91-b3ca-ef46-bc63-89bdf1a8baa1} | |
[marionette log] SAVING ICON | |
[marionette log] SAVING TITLE | |
[marionette log] I SAVED {73851e0b-bad3-7c46-8ad1-4000b20df007} | |
[marionette log] {"url":"http://localhost:49873/favicon.html","title":"http://localhost:49873/favicon.html","frecency":1} | |
[marionette log] UPDATING ICON | |
[marionette log] ATTEMPTING TO SAVE {73851e0b-bad3-7c46-8ad1-4000b20df007} {70d7bd91-b3ca-ef46-bc63-89bdf1a8baa1} | |
[marionette log] DENIED | |
[marionette log] UPDATING TITLE | |
[marionette log] ATTEMPTING TO SAVE {73851e0b-bad3-7c46-8ad1-4000b20df007} {70d7bd91-b3ca-ef46-bc63-89bdf1a8baa1} | |
[marionette log] DENIED | |
[marionette log] UPDATING ICON | |
[marionette log] ATTEMPTING TO SAVE {73851e0b-bad3-7c46-8ad1-4000b20df007} {73851e0b-bad3-7c46-8ad1-4000b20df007} | |
[marionette log] UPDATING TITLE | |
[marionette log] ATTEMPTING TO SAVE {73851e0b-bad3-7c46-8ad1-4000b20df007} {73851e0b-bad3-7c46-8ad1-4000b20df007} | |
[marionette log] I SAVED {cb6483fe-20d5-9744-afd9-64eb27be2c5e} | |
[marionette log] {"url":"http://localhost:49873/favicon.html","title":"http://localhost:49873/favicon.html","frecency":1,"iconUri":"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"} | |
[marionette log] I SAVED {61f6e888-7734-2445-9e24-a04f0dff1b10} | |
[marionette log] {"url":"http://localhost:49873/favicon.html","title":"Sample page","frecency":1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment