@react-hook/throttle
Advanced tools
Comparing version 0.1.6 to 1.0.0
@@ -33,8 +33,12 @@ 'use strict' | ||
function _ref() { | ||
nextTimeout.current !== null && | ||
(0, _requestTimeout.clearRequestTimeout)(nextTimeout.current) | ||
tailTimeout.current !== null && | ||
(0, _requestTimeout.clearRequestTimeout)(tailTimeout.current) | ||
nextTimeout.current = null | ||
tailTimeout.current = null | ||
if (nextTimeout.current !== null) { | ||
;(0, _requestTimeout.clearRequestTimeout)(nextTimeout.current) | ||
nextTimeout.current = null | ||
} | ||
if (tailTimeout.current !== null) { | ||
;(0, _requestTimeout.clearRequestTimeout)(tailTimeout.current) | ||
tailTimeout.current = null | ||
} | ||
calledLeading.current = false | ||
@@ -61,5 +65,5 @@ } | ||
calledLeading.current = true | ||
} else { | ||
nextTimeout.current = (0, _requestTimeout.requestTimeout)(_ref2, wait) | ||
} | ||
nextTimeout.current = (0, _requestTimeout.requestTimeout)(_ref2, wait) | ||
} else { | ||
@@ -66,0 +70,0 @@ tailTimeout.current !== null && |
@@ -26,6 +26,12 @@ import {useEffect, useCallback, useState, useRef} from 'react' | ||
function _ref() { | ||
nextTimeout.current !== null && clearRequestTimeout(nextTimeout.current) | ||
tailTimeout.current !== null && clearRequestTimeout(tailTimeout.current) | ||
nextTimeout.current = null | ||
tailTimeout.current = null | ||
if (nextTimeout.current !== null) { | ||
clearRequestTimeout(nextTimeout.current) | ||
nextTimeout.current = null | ||
} | ||
if (tailTimeout.current !== null) { | ||
clearRequestTimeout(tailTimeout.current) | ||
tailTimeout.current = null | ||
} | ||
calledLeading.current = false | ||
@@ -52,5 +58,5 @@ } | ||
calledLeading.current = true | ||
} else { | ||
nextTimeout.current = requestTimeout(_ref2, wait) | ||
} | ||
nextTimeout.current = requestTimeout(_ref2, wait) | ||
} else { | ||
@@ -57,0 +63,0 @@ tailTimeout.current !== null && clearRequestTimeout(tailTimeout.current) |
{ | ||
"name": "@react-hook/throttle", | ||
"version": "0.1.6", | ||
"version": "1.0.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "author": "Jared Lunde <jared@BeStellar.co> (https://BeStellar.co)", |
@@ -33,6 +33,12 @@ import {useEffect, useCallback, useState, useRef} from 'react' | ||
() => () => { | ||
nextTimeout.current !== null && clearRequestTimeout(nextTimeout.current) | ||
tailTimeout.current !== null && clearRequestTimeout(tailTimeout.current) | ||
nextTimeout.current = null | ||
tailTimeout.current = null | ||
if (nextTimeout.current !== null) { | ||
clearRequestTimeout(nextTimeout.current) | ||
nextTimeout.current = null | ||
} | ||
if (tailTimeout.current !== null) { | ||
clearRequestTimeout(tailTimeout.current) | ||
tailTimeout.current = null | ||
} | ||
calledLeading.current = false | ||
@@ -53,4 +59,5 @@ }, | ||
} | ||
nextTimeout.current = requestTimeout(() => next(this_, args), wait) | ||
else { | ||
nextTimeout.current = requestTimeout(() => next(this_, args), wait) | ||
} | ||
} | ||
@@ -57,0 +64,0 @@ else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9505
202
1