1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00
This commit is contained in:
cTn 2014-01-20 20:15:23 +01:00
parent 0ccdc762b4
commit ed963bfdad

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);
});
}