Skip to content

Commit

Permalink
relax autosave
Browse files Browse the repository at this point in the history
  • Loading branch information
korelstar committed May 17, 2020
1 parent 85dbc59 commit ee2c60b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default {
fullscreen: false,
preview: false,
actionsOpen: false,
autosaveTimer: null,
}
},
Expand Down Expand Up @@ -224,7 +225,12 @@ export default {
autotitle: routeIsNewNote(this.$route),
}
store.commit('add', note)
setTimeout(saveNote.bind(this, note.id), 1000)
if (this.autosaveTimer === null) {
this.autosaveTimer = setTimeout(() => {
this.autosaveTimer = null
saveNote(note.id)
}, 2000)
}
}
},
Expand Down

0 comments on commit ee2c60b

Please sign in to comment.