From fe5bd51d766fb5e6980b2b446afe33be18e1780a Mon Sep 17 00:00:00 2001 From: Nulo Date: Sun, 27 Aug 2023 22:23:22 -0300 Subject: [PATCH] return to last page viewed when opening app again --- package.json | 1 + pnpm-lock.yaml | 11 +++++++++++ src/App.svelte | 9 +++++++-- src/lib/idbValStore.ts | 14 ++++++++++++++ src/lib/router.ts | 16 +++++++++++++++- src/views/Page.svelte | 6 ++++++ 6 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 src/lib/idbValStore.ts diff --git a/package.json b/package.json index 573bc53..04138e2 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "dependencies": { "bootstrap-icons": "^1.10.4", "eva-icons": "^1.1.3", + "idb-keyval": "^6.2.1", "nanoid": "^4.0.2", "navaid": "^1.2.0", "regexparam": "^2.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4688a88..57c464b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,5 +1,9 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + dependencies: bootstrap-icons: specifier: ^1.10.4 @@ -7,6 +11,9 @@ dependencies: eva-icons: specifier: ^1.1.3 version: 1.1.3 + idb-keyval: + specifier: ^6.2.1 + version: 6.2.1 nanoid: specifier: ^4.0.2 version: 4.0.2 @@ -686,6 +693,10 @@ packages: function-bind: 1.1.1 dev: true + /idb-keyval@6.2.1: + resolution: {integrity: sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==} + dev: false + /ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: false diff --git a/src/App.svelte b/src/App.svelte index e02da57..4825d72 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,9 +1,14 @@
- + {#await setRouteToLastPagePromise then} + + {/await}