Skip to content

Commit

Permalink
Move local store to package
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed Jan 15, 2022
1 parent 5369d79 commit b559e53
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 54 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"prettier": "^2.5.1",
"prettier-plugin-svelte": "^2.5.1",
"snowpack": "^3.8.8",
"svelte": "^3.46.1"
"svelte": "^3.46.1",
"svelte-storages": "^0.0.1"
},
"scripts": {
"build": "snowpack build",
Expand Down
4 changes: 2 additions & 2 deletions src/stores/cities.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { storageKeyValueStore } from 'src/stores/storageKeyValueStore'
import { localStore } from 'svelte-storages'

export const cities = storageKeyValueStore('cities', localStorage)
export const cities = localStore('cities')
10 changes: 6 additions & 4 deletions src/stores/settings.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { storageKeyValueStore } from 'src/stores/storageKeyValueStore'
import { localStore } from 'svelte-storages'

/**
* Settings store
*
* Keys:
* - current_city
* - locale
*
* - `current_city`
* - `locale`
*/
export const settings = storageKeyValueStore('settings', localStorage)
export const settings = localStore('settings')
45 changes: 0 additions & 45 deletions src/stores/storageKeyValueStore.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/stores/weather.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { storageKeyValueStore } from 'src/stores/storageKeyValueStore'
import { sessionStore } from 'svelte-storages'

export const weather = storageKeyValueStore('weather', sessionStorage)
export const weather = sessionStore('weather')
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2850,6 +2850,11 @@ svelte-preprocess@^4.7.2:
sorcery "^0.10.0"
strip-indent "^3.0.0"

svelte-storages@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/svelte-storages/-/svelte-storages-0.0.1.tgz#fb4d8ae2abb0ce8d297b76db708b786e98f31834"
integrity sha512-Gm7M6DowxLPiggY1VhWHLzPFsEXHoh07nAHHAQCllD6RhFOii2r8B1JTafrG3aoKQlVyjr4lKYlkpnOxdFhxpw==

svelte@^3.46.1:
version "3.46.1"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.46.1.tgz#8ea23595824a39d47d04c16c217000fbc4c52c49"
Expand Down

0 comments on commit b559e53

Please sign in to comment.