File size: 485 Bytes
8d1819a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { createStore } from "/js/AlpineStore.js";

// define the model object holding data and functions
const model = {
    example1:"Example 1",
    example2:"Example 2",

    // gets called when the store is created
    init(){
        console.log("Example store initialized");
    },

    clickHandler(event){
        console.log(event)
    }

};

// convert it to alpine store
const store = createStore("_exampleStore", model);

// export for use in other files
export { store };