-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackground.js
More file actions
20 lines (20 loc) · 833 Bytes
/
background.js
File metadata and controls
20 lines (20 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('main.html', {
frame: 'chrome',
id: 'main-window',
minWidth: 960,
maxWidth: 0,
minHeight: 750,
maxHeight: 0
}, function(main_window) {
main_window.onClosed.addListener(function() {
// connectionId is passed from the script side through the chrome.runtime.getBackgroundPage reference
// allowing us to automatically close the port when application shut down
if (serialConnectionId != -1) {
chrome.serial.disconnect(serialConnectionId, function() {
console.log('CLEANUP: Connection to serial port was opened after application closed, closing the connection.');
});
}
});
});
});