-
Notifications
You must be signed in to change notification settings - Fork 6
/
app.js
30 lines (27 loc) · 794 Bytes
/
app.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
import "./shared/device-polyfill";
import { MessageBuilder } from "./shared/message";
import { PlayerControl } from "./shared/player";
const appId = 1017560;
const messageBuilder = new MessageBuilder({ appId });
const playerControl = new PlayerControl(messageBuilder);
App({
globalData: {
messageBuilder: messageBuilder,
playerControl: playerControl,
},
onCreate(options) {
console.log("app on create invoke");
messageBuilder.connect();
playerControl.connect();
hmSetting.setBrightScreen(60);
// constantly refresh player info
timer.createTimer(10, 10000, () => {
playerControl.update();
});
},
onDestroy(options) {
console.log("app on destroy invoke");
hmSetting.setBrightScreenCancel();
messageBuilder.disConnect();
},
});