Skip to content

Commit

Permalink
feat(project): save project in close
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Nov 1, 2021
1 parent b58109d commit 4a8a3dd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pages/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
import { useEnv } from '@/use/env'
import { useKeyboard } from '@/use/keyboard'
import { useProject } from '@/use/project'
import { useLocalStorage } from '@/use/storage/local'
import { useHead } from '@vueuse/head'
import { computed, onMounted, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
const PROJECT = useProjectStore()
const CONTEXT = useContextStore()
Expand All @@ -26,6 +28,8 @@
const env = useEnv()
const project = useProject()
const entity = useEntity()
const local = useLocalStorage()
const router = useRouter()
const { t } = useI18n()
keyboard.init()
Expand All @@ -34,6 +38,10 @@
project.onLoadProject()
})
window.onbeforeunload = function () {
if (router.currentRoute.value.path === '/') local.onSaveProject()
}
onUnmounted(() => {
keyboard.destroy()
})
Expand Down

0 comments on commit 4a8a3dd

Please sign in to comment.