| 1 | import { createStore } from "/js/AlpineStore.js"; |
| 2 | |
| 3 | // define the model object holding data and functions |
| 4 | const model = { |
| 5 | example1:"Example 1", |
| 6 | example2:"Example 2", |
| 7 | |
| 8 | // gets called when the store is created |
| 9 | init(){ |
| 10 | console.log("Example store initialized"); |
| 11 | }, |
| 12 | |
| 13 | clickHandler(event){ |
| 14 | console.log(event) |
| 15 | } |
| 16 | |
| 17 | }; |
| 18 | |
| 19 | // convert it to alpine store |
| 20 | const store = createStore("_exampleStore", model); |
| 21 | |
| 22 | // export for use in other files |
| 23 | export { store }; |