adding notes to recent list only after some time period (currently 1500ms)

This commit is contained in:
azivner
2017-08-23 19:57:44 -04:00
parent 9d80f56d81
commit 8a928f05f3
2 changed files with 16 additions and 7 deletions

View File

@@ -170,13 +170,22 @@ function loadNote(noteId) {
}
function addRecentNote(noteId, noteTitle) {
// if it's already there, remove the note
recentNotes = recentNotes.filter(note => note.noteId !== noteId);
const origDate = new Date();
recentNotes.unshift({
noteId: noteId,
noteTitle: noteTitle
});
setTimeout(function() {
// we include the note into recent list only if the user stayed on the note at least 5 seconds
if (noteId === globalNote.detail.note_id) {
// if it's already there, remove the note
recentNotes = recentNotes.filter(note => note.noteId !== noteId);
// console.log("added after " + (new Date().getTime() - origDate.getTime()));
recentNotes.unshift({
noteId: noteId,
noteTitle: noteTitle
});
}
}, 1500);
}
function encryptNote() {