10.3.x-maintenance
cTn 2014-01-20 20:15:23 +01:00
parent 0ccdc762b4
commit ed963bfdad
1 changed files with 6 additions and 2 deletions

View File

@ -7,8 +7,12 @@ function start_app() {
window_child.onClosed.addListener(function() {
// connectionId is passed from the script side through the chrome.runtime.getBackgroundPage refference
// allowing us to automatically close the port when application shut down
if (app_window.serial.connectionId > 0) {
chrome.serial.disconnect(app_window.serial.connectionId, function(result) {
// save connectionId in separate variable before app_window is destroyed
var connectionId = app_window.serial.connectionId;
if (connectionId > 0) {
chrome.serial.disconnect(connectionId, function(result) {
console.log('SERIAL: Connection closed - ' + result);
});
}