Skip to content

Commit

Permalink
chore(loader): remove window reload and destroy initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed May 4, 2022
1 parent fd6ac5b commit 1201af5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 32 deletions.
14 changes: 0 additions & 14 deletions packages/better-write-app/src/use/destroy.ts

This file was deleted.

16 changes: 1 addition & 15 deletions packages/better-write-app/src/use/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { usePlugin } from 'better-write-plugin-core'
import { useBreakpoint } from './breakpoint'
import { useRaw } from './raw'
import { useFileSystemAccess } from '@vueuse/core'
import { useSubstitution } from './tools/substitution'

export const useProject = () => {
const PROJECT = useProjectStore()
Expand All @@ -44,12 +43,6 @@ export const useProject = () => {
const breakpoints = useBreakpoint()
const { t } = i18n.global

let timer: any

const destroy = () => {
clearInterval(timer as any)
}

const external = () => {
const n = async (type: ProjectType, skipAlert: boolean = false) => {
if (!skipAlert && !confirm(t('toast.project.createAlert'))) return
Expand All @@ -72,9 +65,7 @@ export const useProject = () => {
if (!breakpoints.isMobile().value && type === 'creative')
ABSOLUTE.aside = true

await local.onSaveProject(false)

window.location.reload()
await local.onSaveProject()
}

return { new: n }
Expand All @@ -90,10 +81,6 @@ export const useProject = () => {

await nextTick

destroy()

await nextTick

toast.success(t('toast.project.create'))
})
}
Expand Down Expand Up @@ -469,7 +456,6 @@ export const useProject = () => {
}

return {
destroy,
create,
external,
onLoadProject,
Expand Down
2 changes: 0 additions & 2 deletions packages/better-write-app/src/use/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { useLocalStorage } from './storage/local'
import { useStorage } from './storage/storage'
import { useCreativeType } from './type/creative'
import { useDefines } from './defines'
import { useDestroy } from './destroy'
import { useEditor } from './editor'
import { useEntity } from './entity'
import { useFactory } from './factory'
Expand Down Expand Up @@ -177,7 +176,6 @@ export const useStart = () => {
storage: useStorage(),
creative: useCreativeType(),
defines: useDefines(),
destroy: useDestroy(),
editor: useEditor(),
entity: useEntity(),
env: useEnv(),
Expand Down
1 change: 0 additions & 1 deletion packages/better-write-types/src/types/plugin/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export interface PluginHooks {
storage: PluginHook
creative: PluginHook
defines: PluginHook
destroy: PluginHook
editor: PluginHook
entity: PluginHook
env: PluginHook
Expand Down

0 comments on commit 1201af5

Please sign in to comment.