forked from betaflight/blackbox-log-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
33 lines (29 loc) · 854 Bytes
/
background.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
'use strict';
function startApplication() {
var timestampId = Date.now();
chrome.app.window.create('index.html',
{
id: "main" + timestampId,
frame: 'chrome',
innerBounds : {
'width' : 1340,
'height' : 920
}
},
function (createdWindow) {
if (getChromeVersion() >= 54) {
createdWindow.icon = 'images/bf_icon_128.png';
}
try {
var gui = require('nw.gui');
createdWindow.contentWindow.argv = gui.App.argv;
} catch (e) {
// Require not supported, inside chrome
}
});
}
function getChromeVersion () {
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
return raw ? parseInt(raw[2], 10) : false;
}
chrome.app.runtime.onLaunched.addListener(startApplication);