1 Star 2 Fork 26

supercoeus / Aircontroller-scrcpy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
devicesWorker.js 957 Bytes
一键复制 编辑 原始数据 按行查看 历史
yanghang 提交于 2021-12-25 19:32 . 首次提交
var cmd = require('node-cmd');
const path = require('path');
const adb_path = path.join(__dirname, '../adb/adb.exe');
var lastData = [];
loadDevices();
setInterval(loadDevices, 10000);
function loadDevices(){
let stateMap = {
device:'已连接电脑',
offline:'无法链接',
unauthorized:'未授权'
};
let data2 = [];
cmd.get(adb_path + " devices", (e, d, s) => {
res = d.split("\n");
res.forEach((item, index) => {
if (index < 1 || !(item.replace(/[ ]*/g, '')) || item.length == 1) {
return
}
var deviceInfo = item.replace("\r","").split(" ");
data2.push({ client: deviceInfo[0],stateName:stateMap[deviceInfo[1]] });
});
// if(JSON.stringify(lastData)!=JSON.stringify(data2)){
// lastData = data2;
// postMessage(data2);
// }
postMessage(data2);
});
}
1
https://gitee.com/supercoeus/aircontroller-scrcpy.git
git@gitee.com:supercoeus/aircontroller-scrcpy.git
supercoeus
aircontroller-scrcpy
Aircontroller-scrcpy
master

搜索帮助