forked from rjs-team/rjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
62 lines (46 loc) · 1.21 KB
/
test.js
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
puts("asdf");
setTimeout(function() { setTimeout(function() { puts("2!"); }, 100); puts("delayed!"); }, 1000);
setTimeout(function() { puts("3"); }, 100);
setTimeout(function() { puts("3"); }, 1100);
setTimeout(function() { puts("3"); }, 1100);
setTimeout(function() { puts("3"); throw new Error(); }, 1100);
setTimeout(function() { puts("4"); }, 1000);
puts(getFileSync("test.js"));
puts(readDir("."));
try {
puts(1, 2);
} catch (e) {
puts('Caught error: '+e);
}
var t = new Test();
puts("Test: " + Object.keys(Test.prototype) + ";");
t.test_puts(t.test_prop);
puts("Globals: " + Object.keys(this));
let window;
function changeClear() {
if (!window) return;
window.clearColor(1, 0, 0, 1);
window.clear();
}
function ping() {
if (window) window.ping();
else return puts("puts: window == null");
setTimeout(ping, 500);
}
setTimeout(function() {
window = new Window();
window.onevent = function(event) {
puts("Event! " + JSON.stringify(event));
};
ping();
setTimeout(changeClear, 1000);
setTimeout(function() {
puts("Wait over... closing...");
window.close();
setTimeout(function() {
puts("Second wait...");
window = null;
}, 10000);
}, 10000);
}, 1000);
1 + 2 + Object