forked from qwadratic/pygun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo2.html
99 lines (88 loc) · 2.78 KB
/
todo2.html
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script src="http://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"><></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/unset.js"></script>
<script>
var gun = Gun("ws://127.0.0.1:8000/gun")
let basicTest = () => {
gun.get("proj.simple://1").put({
"attr1": "val"
})
gun.get("proj.simple://2").put({
"attr2": 5
})
gun.get("proj.simple://2").put({
"attr2": "zc"
}) // should fail.
/*
gun.get("proj.simple://2").get("list/mychars").set("a")
gun.get("proj.simple://2").get("list/mychars").set("b")
gun.get("proj.simple://2").get("list/mychars").set("c")
*/
}
let midTest = () => {
gun.get("proj.person://4").put({
name: "ahmed"
})
gun.get("proj.person://4").put({
"name": "ahmed"
})
gun.get("proj.person://4").get("email").put({
"addr": "[email protected]",
})
gun.get("proj.person://5").get("email").put({
"addr": "[email protected]",
})
gun.get("proj.person://5").get("email").put({
"addr": "[email protected]",
})
gun.get("proj.person://5").get("email").put({
"addr": "[email protected]",
})
}
let advTest = () => {
gun.get("proj.human://7").put({
"name": "xmon"
})
gun.get("proj.human://7").get("phone").put({
"model": "samsung"
})
gun.get("proj.human://7").get("phone").get("os").put({
"name": "android"
})
gun.get("proj.human://8").put({
"name": "richxmon"
})
gun.get("proj.human://8").get("phone").put({
"model": "iphone"
})
gun.get("proj.human://8").get("phone").get("os").put({
"name": "ios"
})
gun.get("proj.human://8").get("list_favcolors").set("white")
gun.get("proj.human://8").get("list_favcolors").set("red")
gun.get("proj.human://8").get("list_favcolors").set("blue")
gun.get("proj.human://8").get("list_favcolors").unset("red")
gun.get("proj.human://8").get("list_langs").set({
"name": "python"
})
gun.get("proj.human://8").get("list_langs").set({
"name": "ruby"
})
}
let nesetedListTest = () => {
gun.get("proj.programmar://8").get("list_langs").set({
"name": "python",
"list_releases": {
"0": "3.6",
"1": "3.7"
}
})
}
//basicTest()
//midTest()
//advTest()
nesetedListTest()
console.log("here now..")
</script>