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;