handling of beforeunload - we save the note before unloading the page

This commit is contained in:
azivner 2017-09-04 16:03:07 -04:00
parent 1f7f7d105c
commit af33a30ad8
2 changed files with 6 additions and 1 deletions

View file

@ -232,3 +232,8 @@ $("#jumpToNoteForm").submit(function() {
return false;
});
$(window).on('beforeunload', function(){
// asynchronously send the request and don't wait for result
saveNoteIfChanged();
});

View file

@ -212,5 +212,5 @@ function encryptNote() {
// To print or store the binary data, you may convert it to hex
let encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes);
console.log("encrypted: " + encryptedBytes);
console.log("encrypted: " + encryptedHex);
}