-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.js
More file actions
45 lines (41 loc) · 1 KB
/
Copy pathdebug.js
File metadata and controls
45 lines (41 loc) · 1 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
/**
* @type {import("./js_src/index")}
*/
let index = require("./lib/index")
let rl = require("readline").createInterface(process.stdin)
let lib = index.create(949651579085131826n, index.CreateFlags.Default)
let loop = true
let gstatus = lib.status
rl.on("line", () => {
loop = false;
})
if (lib.status == index.Result.Ok) {
let { status, sdk } = lib
sdk.set_log_hook(index.LogLevel.Debug, (lvl, msg) => {
console.log(`${lvl} ${msg}`)
})
}
setTimeout(() => {
if (lib.status == index.Result.Ok && loop) {
let { sdk } = lib
sdk.tl(() => {
console.log("Hello World")
})
}
}, 4000)
// Simulate a game loop
let inv = setInterval(() => {
if(lib.status == index.Result.Ok && loop) {
let {status, sdk} = lib
//@ts-ignore
lib.status = sdk.run_callbacks();
if (status != index.Result.Ok) {
return;
}
} else {
clearInterval(inv)
inv.unref()
process.exit()
}
}, 50)
inv.ref()