(dictionary = {})
| 48 | } |
| 49 | |
| 50 | function scan(dictionary = {}) { |
| 51 | return new Promise((resolve /*, reject */) => { |
| 52 | let result = []; |
| 53 | WiFi.scan(dictionary, item => { |
| 54 | if (!item) |
| 55 | resolve(result); |
| 56 | else if (!result.find(value => item.ssid == value)) |
| 57 | result.push(item.ssid); |
| 58 | |
| 59 | }); |
| 60 | }); |
| 61 | } |
| 62 | |
| 63 | scan().then(result => result.forEach(name => trace(name, "\n"))); |
| 64 |