fix(core): update

This commit is contained in:
2022-10-21 11:55:42 +02:00
parent f479c11574
commit d479cd9e7e
7 changed files with 69 additions and 6 deletions

View File

@@ -0,0 +1,22 @@
import * as plugins from './smartping.plugins.js';
export class Smartping {
public async ping(hostArg: string, timeoutArg: number = 500): Promise<plugins.ping.PingResponse> {
const result = await plugins.ping.promise.probe(hostArg, {
timeout: timeoutArg
})
return result;
}
public async pingAlive(hostArg: string, timeoutArg: number = 500): Promise<boolean> {
const result = await plugins.ping.promise.probe(hostArg, {
timeout: timeoutArg
}).catch();
//console.log(result);
if (result.alive) {
return true;
} else {
return false;
}
}
}