1.0.1 • Published 4 years ago

@westtrade/data-store v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

DataStore for svelte

Example

const DataStore = require('@westtrade/data-store')

const someStore = new DataStore(() =>
	fetch('http://some-api.js/api.json').then(res => res.json())
)

someStore.sync()

module.exports = someStore
<script>
	import someStore from './someStore'
</script>

{#if $someStore.loading}
<div>
	Loading...
</div>
{: else}
<pre>
    { JSON.stringify($someStore) }
</pre>
{/if}