pubo-utils 1.0.33 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/watch-dog/index.d.ts +13 -0
- package/es/watch-dog/index.js +30 -0
- package/lib/watch-dog/index.d.ts +13 -0
- package/lib/watch-dog/index.js +37 -0
- package/package.json +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface WatchDogProps {
|
|
2
|
+
limit: number;
|
|
3
|
+
onTimeout: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare class WatchDog {
|
|
6
|
+
private readonly limit;
|
|
7
|
+
private readonly onTimeout;
|
|
8
|
+
private timeout;
|
|
9
|
+
constructor({ limit, onTimeout }: WatchDogProps);
|
|
10
|
+
feed(): void;
|
|
11
|
+
init(): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var WatchDog =
|
|
2
|
+
/** @class */
|
|
3
|
+
function () {
|
|
4
|
+
function WatchDog(_a) {
|
|
5
|
+
var _b = _a.limit,
|
|
6
|
+
limit = _b === void 0 ? 10 : _b,
|
|
7
|
+
onTimeout = _a.onTimeout;
|
|
8
|
+
this.limit = 10;
|
|
9
|
+
this.timeout = null;
|
|
10
|
+
this.limit = limit;
|
|
11
|
+
this.onTimeout = onTimeout;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
WatchDog.prototype.feed = function () {
|
|
15
|
+
clearTimeout(this.timeout);
|
|
16
|
+
this.init();
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
WatchDog.prototype.init = function () {
|
|
20
|
+
var _this = this;
|
|
21
|
+
|
|
22
|
+
this.timeout = setTimeout(function () {
|
|
23
|
+
return _this.onTimeout();
|
|
24
|
+
}, this.limit * 1000);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return WatchDog;
|
|
28
|
+
}();
|
|
29
|
+
|
|
30
|
+
export { WatchDog };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface WatchDogProps {
|
|
2
|
+
limit: number;
|
|
3
|
+
onTimeout: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare class WatchDog {
|
|
6
|
+
private readonly limit;
|
|
7
|
+
private readonly onTimeout;
|
|
8
|
+
private timeout;
|
|
9
|
+
constructor({ limit, onTimeout }: WatchDogProps);
|
|
10
|
+
feed(): void;
|
|
11
|
+
init(): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WatchDog = void 0;
|
|
7
|
+
|
|
8
|
+
var WatchDog =
|
|
9
|
+
/** @class */
|
|
10
|
+
function () {
|
|
11
|
+
function WatchDog(_a) {
|
|
12
|
+
var _b = _a.limit,
|
|
13
|
+
limit = _b === void 0 ? 10 : _b,
|
|
14
|
+
onTimeout = _a.onTimeout;
|
|
15
|
+
this.limit = 10;
|
|
16
|
+
this.timeout = null;
|
|
17
|
+
this.limit = limit;
|
|
18
|
+
this.onTimeout = onTimeout;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
WatchDog.prototype.feed = function () {
|
|
22
|
+
clearTimeout(this.timeout);
|
|
23
|
+
this.init();
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
WatchDog.prototype.init = function () {
|
|
27
|
+
var _this = this;
|
|
28
|
+
|
|
29
|
+
this.timeout = setTimeout(function () {
|
|
30
|
+
return _this.onTimeout();
|
|
31
|
+
}, this.limit * 1000);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return WatchDog;
|
|
35
|
+
}();
|
|
36
|
+
|
|
37
|
+
exports.WatchDog = WatchDog;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pubo-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=8.0.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "c5218221058a304c692c4e9e789e7b8f8a2c7bce"
|
|
22
22
|
}
|