10 Commits

Author SHA1 Message Date
0bdddc32d1 1.0.8 2023-04-19 17:21:17 +02:00
40651a5660 fix(core): update 2023-04-19 17:21:16 +02:00
5f1b4a784e 1.0.7 2022-10-21 14:24:36 +02:00
2da9122c68 fix(core): update 2022-10-21 14:24:36 +02:00
5d80323baa 1.0.6 2022-10-21 12:06:25 +02:00
72fccebf14 fix(core): update 2022-10-21 12:06:24 +02:00
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 4769 additions and 14 deletions

4
package-lock.json generated
View File

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

View File

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

4716
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -1,3 +1 @@
import * as plugins from './smartping.plugins.js'; export * from './smartping.classes.smartping.js';
export let demoExport = 'Hi there! :) This is an exported string';

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 = {}; import ping from 'ping';
export { removeme };
export {
ping
}