Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function demo() {
// Initialize wifi module
// Absolutely necessary even to set interface to null
wifi.init({
iface : null // network interface, choose a random wifi interface if set to null
});
data = {samples: []}
if (process.argv.length <= 2) {
n = 1
} else {
n = process.argv[2]
}
for (var i=0; i < n; i++){
// Scan networks
wifi.scan(function(err, networks) {
if (err) {
console.log(err);
async function record(n=1, completion=function(data) {}, hook=function(i, sample) {}) {
console.log(" * [INFO] Starting to listen")
wifi.init({
iface : null // network interface, choose a random wifi interface if set to null
});
samples = []
function startScan(i) {
var date1 = new Date();
wifi.scan(function(err, networks) {
if (err || networks.length == 0) {
console.log(" * [ERR] Failed to collect " + i + ". Waiting for a second before retrying... (" + err + ")")
utils.sleep(1000)
startScan(i);
return
}
console.log(" * [INFO] Collected sample " + i + " with " + networks.length + " networks in " + ( (new Date() - date1) / 1000 ) + "s")
samples.push(networks)
hook(i, networks);
function record(n, completion, hook) {
wifi.init({
iface : null // network interface, choose a random wifi interface if set to null
});
samples = []
function startScan(i) {
wifi.scan(function(err, networks) {
if (err || networks.length == 0) {
startScan(i);
return
}
if (i <= 0) {
return completion({samples: samples});
}
hook(i, networks)
samples.push(networks)
startScan(i-1);
constructor(filePath, document) {
super(filePath, document);
this.container = 'right';
this.isOn = false;
this.isConnected = false;
this.isConnecting = true;
this.network = false;
wifi.init({
iface: null // network interface, choose a random wifi interface if set to null
});
}