Improved typescript visualizer. Opens browser window in chrome appmode by default.

This commit is contained in:
Henning Dieterichs
2019-08-05 02:09:06 +02:00
parent fe2f5c95b7
commit 85692ac720
12 changed files with 187 additions and 28 deletions

View File

@@ -43,7 +43,11 @@ export class ConnectionHandler {
);
},
openInBrowser: async ({}) => {
open(server.indexUrl);
try {
await launchChrome(server.indexUrl);
} catch (e) {
open(server.indexUrl);
}
},
setPreferredDataExtractor: async ({ dataExtractorId }) => {
if (this.watcher) {
@@ -70,3 +74,13 @@ export class ConnectionHandler {
});
}
}
import chromeLauncher = require("chrome-launcher");
async function launchChrome(url: string): Promise<void> {
const chrome = await chromeLauncher.launch({
startingUrl: url,
// `--window-size=${width},${height}`
chromeFlags: ["--app=" + url],
});
}