-
Notifications
You must be signed in to change notification settings - Fork 129
Expand file tree
/
Copy pathscript_example.js
More file actions
62 lines (50 loc) · 1.35 KB
/
Copy pathscript_example.js
File metadata and controls
62 lines (50 loc) · 1.35 KB
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
/*
* Loon script example
*/
// log
console.log('This is a log');
// http get parameters
var params = {
url: "https://api.example.com/post",
headers: {
Host: "api.example.com",
Content-Type: "application/json",
},
body: "string"
}
// http get request
$httpClient.get('https://example.com/index', function(error, response, data) {
console.log(response);
});
// http get
$httpClient.get(params, function(error, response, data) {
console.log(response);
});
// http post
$httpClient.post(params, function(error, response, data) {
console.log(response);
});
// notification
$notification.post('title', 'subtitle', 'body')
// persistentStore
$persistentStore.write('loon', 'appNameKey')
let res = $persistentStore.read('appNameKey')
console.log(res)
// utils
let ipaso = $utils.ipaso("43.153.80.208");
console.log(ipaso);
let geoip = $utils.geoip("43.153.80.208");
console.log(geoip);
let ipasn = $utils.ipasn("43.153.80.208");
console.log(ipasn);
// unzip
$utils.ungzipTest("H4sIAAAAAAAAE/MICQnQN9QzVDAyMFBwzs/LS00uyczPU3AtLklMyskszkhNAQCZT9rEIwAAAA==");
// timeout
setTimeout(function() {
console.log('This code executes after 1 second');
}, 1000);
setTimeout(function(text) {
console.log('This code executes after 5 seconds');
console.log(text);
$done()
}, 5000, 'This is a parameter passed to the function');