fix(core): update
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartping',
|
||||
version: '1.0.4',
|
||||
version: '1.0.5',
|
||||
description: 'a ping utility'
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
import * as plugins from './smartping.plugins.js';
|
||||
|
||||
export let demoExport = 'Hi there! :) This is an exported string';
|
||||
export * from './smartping.classes.smartping.js';
|
||||
|
22
ts/smartping.classes.smartping.ts
Normal file
22
ts/smartping.classes.smartping.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +1,5 @@
|
||||
const removeme = {};
|
||||
export { removeme };
|
||||
import ping from 'ping';
|
||||
|
||||
export {
|
||||
ping
|
||||
}
|
Reference in New Issue
Block a user