forked from parallaxinc/Parallax-IDE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
36 lines (30 loc) · 880 Bytes
/
background.js
File metadata and controls
36 lines (30 loc) · 880 Bytes
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
34
35
36
'use strict';
function noop(){}
function closeSerialPorts(){
chrome.serial.getConnections(function(connections){
connections.forEach(function(connection){
chrome.serial.disconnect(connection.connectionId, noop);
});
});
}
// Listens for the app launching then creates the window
chrome.app.runtime.onLaunched.addListener(function() {
var width = 1000;
var height = 500;
var windowOpts = {
id: 'main',
state: 'maximized',
bounds: {
width: width,
height: height,
left: Math.round((screen.availWidth - width) / 2),
top: Math.round((screen.availHeight - height) / 2)
}
};
chrome.app.window.create('index.html', windowOpts, function(win){
win.onClosed.addListener(closeSerialPorts);
});
});
chrome.runtime.onInstalled.addListener(function(evt){
chrome.storage.local.set({newVersion: 'newVersion'});
});