Add persist plugin
This commit is contained in:
parent
027077c97a
commit
a0a680c8d2
8 changed files with 24 additions and 6 deletions
src/scripts
9
src/scripts/global.js
Normal file
9
src/scripts/global.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
document.addEventListener('alpine:init', () => {
|
||||
Alpine.store('darkMode', {
|
||||
on: Alpine.$persist(false).as('darkMode'),
|
||||
|
||||
toggle() {
|
||||
this.on = ! this.on
|
||||
}
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue