-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
78 lines (75 loc) · 2.01 KB
/
demo.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
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ScpoWR Demo</title>
<script src="main.js"></script>
<script>
try{
function log(n) {
con.innerHTML += n;
}
function cls() {
con.innerHTML = "";
}
var testFunc = [() => {
cls();
ScpoWR.config.todo = data => log(data);
ScpoWR.fget("test.php", frmTest);
ScpoWR.fpost("test.php", frmTest);
ScpoWR.frequest("get", "test.php", frmTest);
}, () => {
cls();
ScpoWR
.then(() => "hhhh + ")
.then(add => log(add + "success\n"))
.fpost("test.php", "count=123&commit=good")
.then(data => data + "...And I'm coming!\n")
.then(md => log(md))
.fget("test.php", { count: 123, commit: "good" })
.then(data => log(data))
.fpost("test.php", frmTest)
.then(data => log(data))
.then(() => ["test.php", "name=get"])
.fget(true)
.then(data => (log(data), {
url: "test.php",
method: "post",
data: "name=post"
}))
.frequest(true)
.then(data => log(data))
.fget("//wrong-website")
.onerr(() => log("failure\n"))
.then(() => log("you can't see me\n"))
.fpost("//wrong-website")
.then(() => log("you can't see me, too\n"));
}, () => {
cls();
ScpoWR.fset({
ordo: () => log("failure\n"),
todo: data => log(data)
});
ScpoWR.post("test.php", "id=0&count=123&commit=good");
ScpoWR.fget("test.php", "id=1&count=123&commit=good");
ScpoWR.fpost("//wrong-website", "id=2&count=123&commit=good");
ScpoWR.ajax("get", "//wrong-website", "id=2&count=123&commit=good");
}];
}catch(e){document.write(e.message)}
</script>
</head>
<body>
<form id="frmTest">
count:<br />
<input name="count" value="123" /><br />
commit:<br />
<input name="commit" value="good" /><br />
</form>
<button onclick="testFunc[0]()">test0</button>
<button onclick="testFunc[1]()">test1</button>
<button onclick="testFunc[2]()">test2</button>
<h2>Output:</h2>
<pre id="con"></pre>
</body>
</html>