parsec-hooks 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ declare const _default: () => {
|
|
2
2
|
countdown: number;
|
3
3
|
clearCountdownTimer: () => boolean;
|
4
4
|
stopCountdownTimer: () => void;
|
5
|
-
setCountdown: (s: number) => Promise<unknown>;
|
5
|
+
setCountdown: (s: number, onChange?: (count: number) => void) => Promise<unknown>;
|
6
6
|
countdownText: string;
|
7
7
|
};
|
8
8
|
export default _default;
|
@@ -31,7 +31,7 @@ var _default = function _default() {
|
|
31
31
|
countdown: countdown,
|
32
32
|
clearCountdownTimer: clearCountdownTimer,
|
33
33
|
stopCountdownTimer: stopCountdownTimer,
|
34
|
-
setCountdown: (0, _react.useCallback)(function (s) {
|
34
|
+
setCountdown: (0, _react.useCallback)(function (s, onChange) {
|
35
35
|
return new Promise(function (resolve) {
|
36
36
|
stopRef.current = false;
|
37
37
|
setCountdown(s);
|
@@ -46,6 +46,7 @@ var _default = function _default() {
|
|
46
46
|
|
47
47
|
if (now - prev > 1000) {
|
48
48
|
var count = s - Math.round((now - startTime) / 1000);
|
49
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(count);
|
49
50
|
setCountdown(count);
|
50
51
|
|
51
52
|
if (count <= 0) {
|