-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
33 lines (28 loc) · 810 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
31
32
33
import "./shared/device-polyfill";
import { MessageBuilder } from "./shared/message";
import { getPackageInfo } from "@zos/app";
import { log as Logger } from "@zos/utils";
import * as ble from "@zos/ble";
const logger = Logger.getLogger("eyeofgod-app");
App({
globalData: {
messageBuilder: null,
},
onCreate(options) {
const { appId } = getPackageInfo();
logger.log(`Loading application. App ID: ${appId}`);
const messageBuilder = new MessageBuilder({
appId,
appDevicePort: 20,
appSidePort: 0,
ble,
});
this.globalData.messageBuilder = messageBuilder;
messageBuilder.connect();
},
onDestroy(options) {
logger.log("Destroying application");
this.globalData.messageBuilder &&
this.globalData.messageBuilder.disConnect();
},
});