-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.html
More file actions
34 lines (29 loc) · 840 Bytes
/
demo.html
File metadata and controls
34 lines (29 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Global Store demo</title>
</head>
<body>
<script src="packages/global-store/dist/global-store.js"></script>
<script>
const store = GlobalStore.createStore({
moduleName: 'global-store-test',
version: '1.0.0',
initializer: () => ({ syncValue: 1 })
})
console.log('sync store value', store.value)
const getAsyncStore = GlobalStore.createAsyncStore({
moduleName: 'global-store-async-test',
version: '1.0.0',
initializer: () => ({ asyncValue: 2 })
})
GlobalStore.initializeAsyncStore('global-store-async-test');
(async () => {
const asyncStore = await getAsyncStore
console.log('async store value', asyncStore.value)
})()
</script>
</body>
Open developer tool and check out console
</html>