Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #146 from ryangjchandler/feature/store-specific-dr…
Browse files Browse the repository at this point in the history
…ivers

feature: store specific drivers
  • Loading branch information
ryangjchandler authored Apr 11, 2021
2 parents ff2fa6f + bab9b9c commit 968b4d0
Show file tree
Hide file tree
Showing 5 changed files with 702 additions and 639 deletions.
40 changes: 34 additions & 6 deletions dist/spruce.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/spruce.umd.js.map

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions examples/store-specific-drivers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<html>
<head>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.js" defer></script>
</head>
<body>
<div x-data>
<p>This store uses the `localStorage` driver for persistence.</p>
<p>Toggle the checkbox and see the data persist to the next page load.</p>
<input type="checkbox" x-model="$store.localStorage.checked">
</div>

<div x-data>
<p>This store uses the `sessionStorage` driver for persistence.</p>
<p>Toggle the checkbox and see the data persist to the next page load.</p>
<input type="checkbox" x-model="$store.sessionStorage.checked">
</div>

<script src="/dist/spruce.umd.js"></script>

<script>
Spruce.store('localStorage', {
checked: false,
}, true)

Spruce.store('sessionStorage', {
checked: false,
}, window.sessionStorage)
</script>
</body>
</html>
Loading

0 comments on commit 968b4d0

Please sign in to comment.