4 Commits

Author SHA1 Message Date
7faf31147d 1.0.5 2022-10-21 11:55:42 +02:00
d479cd9e7e fix(core): update 2022-10-21 11:55:42 +02:00
f479c11574 1.0.4 2022-10-20 09:35:03 +02:00
7df770f9fb fix(core): update 2022-10-20 09:35:02 +02:00
8 changed files with 4456 additions and 11 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@pushrocks/smartping",
"version": "1.0.3",
"version": "1.0.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pushrocks/smartping",
"version": "1.0.3",
"version": "1.0.5",
"license": "MIT",
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",

View File

@@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartping",
"version": "1.0.3",
"version": "1.0.5",
"private": false,
"description": "a ping utility",
"main": "dist_ts/index.js",
@@ -13,15 +13,19 @@
"build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "(tsdoc)"
},
"dependencies": {
"@types/ping": "^0.4.1",
"ping": "^0.4.2"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^2.0.5",
"@gitzone/tsdoc": "^1.1.10",
"@gitzone/tsrun": "^1.2.38",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.41"
"@types/node": "^18.11.2"
},
"dependencies": {},
"browserslist": [
"last 1 chrome versions"
],

4409
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,15 @@
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartping from '../ts/index.js';
tap.test('first test', async () => {
console.log(smartping);
let testPing: smartping.Smartping;
tap.test('should create an instance of Smartping', async () => {
testPing = new smartping.Smartping();
expect(testPing).toBeInstanceOf(smartping.Smartping);
});
tap.test('should detect alive', async () => {
await expectAsync(testPing.pingAlive('lossless.com', 1000)).toBeTrue();
})
tap.start();

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartping',
version: '1.0.3',
version: '1.0.5',
description: 'a ping utility'
}

View File

@@ -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';

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;
}
}
}

View File

@@ -1,2 +1,5 @@
const removeme = {};
export { removeme };
import ping from 'ping';
export {
ping
}