@snappmarket/hooks
Advanced tools
Comparing version 0.2.2 to 0.2.3-beta.4cbesil
@@ -13,2 +13,3 @@ import { useRef, useEffect } from 'react'; | ||
}, inputs); | ||
return true; | ||
}); |
@@ -11,4 +11,5 @@ import { useEffect } from 'react'; | ||
useEffect(() => history.listen(fn), [history]); | ||
return true; | ||
}; | ||
export default useRouteChange; |
@@ -13,2 +13,3 @@ import { useRef, useEffect } from 'react'; | ||
}, inputs); | ||
return true; | ||
}); |
@@ -13,4 +13,5 @@ import { useEffect } from 'react'; | ||
}, [history]); | ||
return true; | ||
}; | ||
export default useRouteChange; |
{ | ||
"name": "@snappmarket/hooks", | ||
"private": false, | ||
"version": "0.2.2", | ||
"version": "0.2.3-beta.4cbesil", | ||
"author": "Jafar Rezaei (SayJeyHi) <jafar.rezaei.ard@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "./index.js", |
@@ -89,2 +89,3 @@ (function (global, factory) { | ||
}, inputs); | ||
return true; | ||
}); | ||
@@ -206,2 +207,3 @@ | ||
}, [history]); | ||
return true; | ||
}; | ||
@@ -208,0 +210,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-router-dom"],t):t((e=e||self).SnappMarketHooks={},e.React,e.ReactRouterDOM)}(this,(function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,u=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){u=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(u)throw o}}return n}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}e.useDebounce=function(e,n){var u,o=r(t.useState(e),2),i=o[0],c=o[1],f=function(){clearTimeout(u)};return t.useEffect((function(){return u=setTimeout((function(){c(e)}),n),f}),[e]),[i,f,c]},e.useDidUpdateEffect=function(e,n){var r=t.useRef(!1);t.useEffect((function(){r.current?e():r.current=!0}),n)},e.useFocus=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current&&n.current.focus()}),[n.current]),n},e.useForceUpdate=function(){var e=r(t.useState(0),2)[1];return t.useCallback((function(){e((function(e){return e+1}))}),[])},e.useGeoLocation=function(e,n){var u,o=!1,i=r(t.useState(),2),c=i[0],f=i[1],a=r(t.useState(),2),s=a[0],l=a[1];return t.useEffect((function(){var t=function(){clearTimeout(u)};return u=setTimeout((function(){l("TIMEOUT")}),e),navigator.geolocation.getCurrentPosition((function(e){o||f(e),t()}),(function(e){o||l(e),t()}),n),function(){o=!0}}),[n]),[c,s]},e.useRouteChange=function(e){var r=n.useHistory();t.useEffect((function(){return r.listen(e)}),[r])},e.useTimer=function(e){var n=u({},{endTime:null,initialTime:0,interval:1e3,step:1,timerType:"INCREMENTAL"},{},e),o=n.endTime,i=n.initialTime,c=n.interval,f=n.step,a=n.timerType,s=t.useRef(null),l=t.useRef(null),p=t.useRef(null),v=r(t.useState(!1),2),m=v[0],d=v[1],y=r(t.useState(i),2),T=y[0],E=y[1],b=function(){h(),R()},h=function(){s.current&&(clearInterval(s.current),s.current=null)},R=function(){p.current&&(clearTimeout(p.current),p.current=null)},S=function(){E(i)},g=function(){s.current||(m&&(S(),d(!1)),s.current=setInterval((function(){E((function(e){return"INCREMENTAL"===a?e+f:e-f}))}),c),function(){if(null!==o){var e=Math.abs(o-(l.current||i))*c;p.current=setTimeout((function(){h(),d(!0)}),e)}}())};return t.useEffect((function(){return b}),[]),t.useEffect((function(){return b(),g(),R}),[]),{pause:function(){l.current=T,b()},reset:function(){l.current=null,b(),S()},start:g,time:T}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-router-dom"],t):t((e=e||self).SnappMarketHooks={},e.React,e.ReactRouterDOM)}(this,(function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,u=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){u=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(u)throw o}}return n}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}e.useDebounce=function(e,n){var u,o=r(t.useState(e),2),i=o[0],c=o[1],f=function(){clearTimeout(u)};return t.useEffect((function(){return u=setTimeout((function(){c(e)}),n),f}),[e]),[i,f,c]},e.useDidUpdateEffect=function(e,n){var r=t.useRef(!1);return t.useEffect((function(){r.current?e():r.current=!0}),n),!0},e.useFocus=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current&&n.current.focus()}),[n.current]),n},e.useForceUpdate=function(){var e=r(t.useState(0),2)[1];return t.useCallback((function(){e((function(e){return e+1}))}),[])},e.useGeoLocation=function(e,n){var u,o=!1,i=r(t.useState(),2),c=i[0],f=i[1],a=r(t.useState(),2),s=a[0],l=a[1];return t.useEffect((function(){var t=function(){clearTimeout(u)};return u=setTimeout((function(){l("TIMEOUT")}),e),navigator.geolocation.getCurrentPosition((function(e){o||f(e),t()}),(function(e){o||l(e),t()}),n),function(){o=!0}}),[n]),[c,s]},e.useRouteChange=function(e){var r=n.useHistory();return t.useEffect((function(){return r.listen(e)}),[r]),!0},e.useTimer=function(e){var n=u({},{endTime:null,initialTime:0,interval:1e3,step:1,timerType:"INCREMENTAL"},{},e),o=n.endTime,i=n.initialTime,c=n.interval,f=n.step,a=n.timerType,s=t.useRef(null),l=t.useRef(null),p=t.useRef(null),v=r(t.useState(!1),2),m=v[0],d=v[1],y=r(t.useState(i),2),T=y[0],E=y[1],b=function(){h(),R()},h=function(){s.current&&(clearInterval(s.current),s.current=null)},R=function(){p.current&&(clearTimeout(p.current),p.current=null)},S=function(){E(i)},g=function(){s.current||(m&&(S(),d(!1)),s.current=setInterval((function(){E((function(e){return"INCREMENTAL"===a?e+f:e-f}))}),c),function(){if(null!==o){var e=Math.abs(o-(l.current||i))*c;p.current=setTimeout((function(){h(),d(!0)}),e)}}())};return t.useEffect((function(){return b}),[]),t.useEffect((function(){return b(),g(),R}),[]),{pause:function(){l.current=T,b()},reset:function(){l.current=null,b(),S()},start:g,time:T}},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"sideEffects": false, | ||
"module": "..\\esm\\useDebounce\\index.js" | ||
"module": "../esm/useDebounce/index.js" | ||
} |
@@ -20,4 +20,5 @@ "use strict"; | ||
}, inputs); | ||
return true; | ||
}; | ||
exports["default"] = _default; |
{ | ||
"sideEffects": false, | ||
"module": "..\\esm\\useDidUpdateEffect\\index.js" | ||
"module": "../esm/useDidUpdateEffect/index.js" | ||
} |
{ | ||
"sideEffects": false, | ||
"module": "..\\esm\\useFocus\\index.js" | ||
"module": "../esm/useFocus/index.js" | ||
} |
{ | ||
"sideEffects": false, | ||
"module": "..\\esm\\useForceUpdate\\index.js" | ||
"module": "../esm/useForceUpdate/index.js" | ||
} |
{ | ||
"sideEffects": false, | ||
"module": "..\\esm\\useGeoLocation\\index.js" | ||
"module": "../esm/useGeoLocation/index.js" | ||
} |
@@ -21,2 +21,3 @@ "use strict"; | ||
}, [history]); | ||
return true; | ||
}; | ||
@@ -23,0 +24,0 @@ |
{ | ||
"sideEffects": false, | ||
"module": "..\\esm\\useRouteChange\\index.js" | ||
"module": "../esm/useRouteChange/index.js" | ||
} |
{ | ||
"sideEffects": false, | ||
"module": "..\\esm\\useTimer\\index.js" | ||
"module": "../esm/useTimer/index.js" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
528196
80
16444
1