mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 12:42:51 +00:00
perf: 优化草稿消息
This commit is contained in:
parent
ba52738904
commit
c8364ed17b
1
resources/assets/js/functions/common.js
vendored
1
resources/assets/js/functions/common.js
vendored
@ -1361,6 +1361,7 @@ const timezone = require("dayjs/plugin/timezone");
|
|||||||
}
|
}
|
||||||
this.__IDBTimer[key] = setTimeout(async _ => {
|
this.__IDBTimer[key] = setTimeout(async _ => {
|
||||||
await localforage.setItem(key, value)
|
await localforage.setItem(key, value)
|
||||||
|
delete this.__IDBTimer[key]
|
||||||
}, delay)
|
}, delay)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
17
resources/assets/js/store/actions.js
vendored
17
resources/assets/js/store/actions.js
vendored
@ -1,9 +1,10 @@
|
|||||||
import * as openpgp from 'openpgp_hi/lightweight';
|
import * as openpgp from 'openpgp_hi/lightweight';
|
||||||
import {debounce} from "lodash";
|
|
||||||
import {initLanguage, languageList, languageName} from "../language";
|
import {initLanguage, languageList, languageName} from "../language";
|
||||||
import {$callData, $urlSafe, SSEClient} from './utils'
|
import {$callData, $urlSafe, SSEClient} from './utils'
|
||||||
import emitter from "./events";
|
import emitter from "./events";
|
||||||
|
|
||||||
|
const saveDraftTimers = {}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
* 预加载
|
* 预加载
|
||||||
@ -3186,7 +3187,19 @@ export default {
|
|||||||
window.__dialogDraft = {id, content}
|
window.__dialogDraft = {id, content}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
commit('SET_DIALOG_DRAFT', {id, content})
|
|
||||||
|
// 清除已有的计时器
|
||||||
|
if (saveDraftTimers[id]) {
|
||||||
|
clearTimeout(saveDraftTimers[id])
|
||||||
|
delete saveDraftTimers[id]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建新的计时器
|
||||||
|
saveDraftTimers[id] = setTimeout(() => {
|
||||||
|
commit('SET_DIALOG_DRAFT', {id, content})
|
||||||
|
delete saveDraftTimers[id]
|
||||||
|
resolve()
|
||||||
|
}, content ? 600 : 0)
|
||||||
},
|
},
|
||||||
|
|
||||||
/** *****************************************************************************************/
|
/** *****************************************************************************************/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user