Refactored JS-code in ble-discovery and added same handling of BLE scanning as the ble-scan example.