From 2b4e5642b336baed9c2da28ed21a130cb7bc6b8d Mon Sep 17 00:00:00 2001 From: cTn Date: Tue, 18 Jun 2013 20:13:26 +0200 Subject: [PATCH] experimental storage of last used port in GUI --- js/serial_backend.js | 25 +++++++++++++++++++++++++ manifest.json | 1 + tabs/initial_setup.html | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/js/serial_backend.js b/js/serial_backend.js index 5276e0a32b..b4c98c8811 100644 --- a/js/serial_backend.js +++ b/js/serial_backend.js @@ -145,6 +145,18 @@ $(document).ready(function() { text: port })); }); + + chrome.storage.local.get('last_used_port', function(result) { + // if last_used_port was set, we try to select it + if (typeof result.last_used_port != 'undefined') { + // check if same port exists, if it does, select it + ports.forEach(function(port) { + if (port == result.last_used_port) { + $(port_picker).val(result.last_used_port); + } + }); + } + }); } else { $(port_picker).append($("