var iwconfig = require("wireless-tools/iwconfig"); let api = {}; api.getStatusWifi = function () { iwconfig.status(function (err, status) { console.log(status); }); // return status ??????????? }; module.exports = api;
how can I pass the "status callback" return to the "getStatusWifi"?
You need to put the "api.getStatusWifi =" part inside the function where the status variable is available.
var iwconfig = require("wireless-tools/iwconfig");
let api = {};
iwconfig.status(function (err, status) {
api.getStatusWifi = function () {
return status;
};
});
module.exports = api;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.