-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
34 lines (31 loc) · 808 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { promiseIt, promiseItAll, promiseItAny } = require('./index');
const { exec } = require('child_process');
(async () => {
const callback = (resolve, reject) => {
exec(`networkQuality`, error => {
if (error) {
handleError(error);
reject(error);
}
resolve('All good. Ran networkQuality.');
});
};
const callback2 = (resolve, reject) => {
exec(`networkQuality -v`, error => {
if (error) {
reject(error);
}
resolve('All good. Ran networkQuality -v.');
});
};
try {
const promise = await promiseIt(callback);
const allPromises = await promiseItAll(callback, callback2);
const anyPromise = await promiseItAny(callback, callback2);
console.log(promise);
console.log(allPromises);
console.log(anyPromise);
} catch (err) {
console.log(err);
}
})();