forked from mystiq/hydrogen-web
fix lint error
This commit is contained in:
parent
d85f93fb16
commit
c823bb125f
1 changed files with 9 additions and 6 deletions
|
@ -145,20 +145,23 @@ export class SettingsView extends TemplateView {
|
||||||
async function openLogs(vm) {
|
async function openLogs(vm) {
|
||||||
const logviewerUrl = (await import("../../../../../../scripts/logviewer/index.html?url")).default;
|
const logviewerUrl = (await import("../../../../../../scripts/logviewer/index.html?url")).default;
|
||||||
const win = window.open(logviewerUrl);
|
const win = window.open(logviewerUrl);
|
||||||
await new Promise(async r => {
|
await new Promise((resolve, reject) => {
|
||||||
let receivedPong = false;
|
let receivedPong = false;
|
||||||
const waitForPong = event => {
|
const waitForPong = event => {
|
||||||
if (event.data.type === "pong") {
|
if (event.data.type === "pong") {
|
||||||
window.removeEventListener("message", waitForPong);
|
window.removeEventListener("message", waitForPong);
|
||||||
receivedPong = true;
|
receivedPong = true;
|
||||||
r();
|
resolve();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener("message", waitForPong);
|
const sendPings = async () => {
|
||||||
while (!receivedPong) {
|
while (!receivedPong) {
|
||||||
win.postMessage({type: "ping"});
|
win.postMessage({type: "ping"});
|
||||||
await new Promise(rr => setTimeout(rr), 100);
|
await new Promise(rr => setTimeout(rr), 100);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
window.addEventListener("message", waitForPong);
|
||||||
|
sendPings().catch(reject);
|
||||||
});
|
});
|
||||||
const logs = await vm.exportLogsBlob();
|
const logs = await vm.exportLogsBlob();
|
||||||
win.postMessage({type: "open", logs: logs.nativeBlob});
|
win.postMessage({type: "open", logs: logs.nativeBlob});
|
||||||
|
|
Loading…
Reference in a new issue