refresh save

This commit is contained in:
Jesse-Ma
2023-03-31 17:19:37 +08:00
parent 83c3901b86
commit d3a29444bf

View File

@@ -379,27 +379,27 @@ export default {
backStoreFunction() {
let that = this;
return function () {
that.backStoreText(that);
that.backStoreText();
}
},
backStoreText(that) {
let nowEditCount = that.noteForm.text.length;
backStoreText() {
let nowEditCount = this.noteForm.text.length;
let nowEditTime = new Date().getTime();
if (Math.abs(nowEditCount - that.lastStoreCount) > 10) {
setStoreText(that.noteForm, that.state, that.secret);
that.lastStoreTime = that.lastEditTime;
that.lastStoreCount = nowEditCount;
if (Math.abs(nowEditCount - this.lastStoreCount) > 10) {
setStoreText(this.noteForm, this.state, this.secret);
this.lastStoreTime = this.lastEditTime;
this.lastStoreCount = nowEditCount;
} else {
if (nowEditTime - that.lastEditTime >= 1000 && nowEditTime - that.lastEditTime < 20000) {
if (that.lastEditTime != that.lastStoreTime) {
setStoreText(that.noteForm, that.state, that.secret);
that.lastStoreTime = that.lastEditTime;
that.lastStoreCount = nowEditCount;
if (nowEditTime - this.lastEditTime >= 1000 && nowEditTime - this.lastEditTime < 20000) {
if (this.lastEditTime != this.lastStoreTime) {
setStoreText(this.noteForm, this.state, this.secret);
this.lastStoreTime = this.lastEditTime;
this.lastStoreCount = nowEditCount;
}
} else if (nowEditTime - that.lastEditTime >= 20000) {
if (that.backStoreTextInterval != null) {
let ivl = that.backStoreTextInterval;
that.backStoreTextInterval = null;
} else if (nowEditTime - this.lastEditTime >= 20000) {
if (this.backStoreTextInterval != null) {
let ivl = this.backStoreTextInterval;
this.backStoreTextInterval = null;
window.clearInterval(ivl);
}
}
@@ -602,7 +602,7 @@ export default {
});
},
beforeunloadHandler() {
this.recordText();
setStoreText(this.noteForm, this.state, this.secret);
},
}
}