simsalabim/sisyphus — pull request #98 by signalkraft (2014-06-21 09:48:39+00:00)
Title: Added function to check if data is restorable

Related to https://github.com/simsalabim/sisyphus/issues/92, enables easier confirmation before restoring:

$('form.autosave').sisyphus({
onBeforeRestore: function() {
var self = this;

if(self.hasDataToRestore()) {
var confirmed = confirm("It looks like you closed the form without saving. Do you want to restore the previous values?");
if( ! confirmed) {
self.manuallyReleaseData();
}
return confirmed;
}
}
});