Skip to content

Commit

Permalink
chore(project): remove autosave init
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed May 2, 2022
1 parent a4cc268 commit 80bc3ba
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
11 changes: 0 additions & 11 deletions packages/better-write-app/src/use/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,10 @@ export const useProject = () => {
const raw = useRaw()
const plugin = usePlugin()
const breakpoints = useBreakpoint()
const substitution = useSubstitution()
const { t } = i18n.global

let timer: any

const init = () => {
timer = local.onAutoSave(EDITOR.configuration.auto)
}

const destroy = () => {
clearInterval(timer as any)
}
Expand Down Expand Up @@ -96,7 +91,6 @@ export const useProject = () => {
await nextTick

destroy()
init()

await nextTick

Expand Down Expand Up @@ -138,10 +132,6 @@ export const useProject = () => {

await nextTick

init()

await nextTick

plugin.emit('plugin-theme-set')

await nextTick
Expand Down Expand Up @@ -479,7 +469,6 @@ export const useProject = () => {
}

return {
init,
destroy,
create,
external,
Expand Down
11 changes: 0 additions & 11 deletions packages/better-write-app/src/use/storage/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,11 @@ export const useLocalStorage = () => {
setProject(storage.getProjectObject())
}

const onAutoSave = (time: number | 'never') => {
if (time === 'never') return null

return setInterval(() => {
onSaveProject(false)

plugin.emit('plugin-auto-save')
}, 1000 * 60 * (time as number))
}

return {
set,
get,
setProject,
getProject,
onSaveProject,
onAutoSave,
}
}

0 comments on commit 80bc3ba

Please sign in to comment.