list-devices.js (954B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { dumpn } = require("resource://devtools/shared/DevToolsUtils.js"); 8 /** 9 * The listDevices command is currently unused in DevTools. We are keeping it while 10 * working on RemoteDebugging NG, in case it becomes needed later. We will remove it from 11 * the codebase if unused at the end of the project. See Bug 1511779. 12 */ 13 const listDevices = function () { 14 dumpn("listDevices"); 15 16 return this.runCommand("host:devices").then(function onSuccess(data) { 17 const lines = data.split("\n"); 18 const res = []; 19 lines.forEach(function (line) { 20 if (!line.length) { 21 return; 22 } 23 const [device] = line.split("\t"); 24 res.push(device); 25 }); 26 return res; 27 }); 28 }; 29 exports.listDevices = listDevices;