1.0.6 • Published 4 months ago

simple-store-svelte v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

simple-store-svelte

A drop in replacement for svelte/store which uses setters/getters to write/read the store's value.

Now you can do:

// stores.js
import { writable } from 'simple-store-svelte'

const store = writable(null)

store.value = 'Hello world!'

const { value } = store

console.log(value) // 'new value!'

Instead of:

// stores.js
import { writable, get } from 'svelte/store'

const store = writable(null)

store.set('Hello world!')

const value = get(store)

console.log(value) // 'new value!'

Other than the example above, the store is identical as the Svelte one, which means you can use it as you always did.

<!-- App.svelte -->
<script>
  import { store } from './stores.js'

  $store = 'Goodbye world!'
</script>

<div>
  { $store } 
  <!-- null -->
  <!-- Hello world! -->
  <!-- Goodbye world! -->
</div>
1.0.2

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.1

8 months ago

1.0.0

2 years ago