@snappmarket/hooks
Advanced tools
Comparing version 0.2.1-alpha.3 to 0.2.1-alpha.gnyj8mm
@@ -11,7 +11,7 @@ import { useEffect, useRef } from 'react'; | ||
useEffect(() => { | ||
setTimeout(() => { | ||
if (ref.current) { | ||
ref.current.focus(); | ||
}, 100); | ||
}, []); | ||
} | ||
}, [ref.current]); | ||
return ref; | ||
}); |
@@ -11,7 +11,7 @@ import { useEffect, useRef } from 'react'; | ||
useEffect(function () { | ||
setTimeout(function () { | ||
if (ref.current) { | ||
ref.current.focus(); | ||
}, 100); | ||
}, []); | ||
} | ||
}, [ref.current]); | ||
return ref; | ||
}); |
{ | ||
"name": "@snappmarket/hooks", | ||
"private": false, | ||
"version": "0.2.1-alpha.3", | ||
"version": "0.2.1-alpha.gnyj8mm", | ||
"author": "Jafar Rezaei (SayJeyHi) <jafar.rezaei.ard@gmail.com>", | ||
@@ -45,3 +45,3 @@ "main": "./index.js", | ||
}, | ||
"gitHead": "9153735fe6c0577252a9b12e7e08fc526b39968e" | ||
"gitHead": "36dda3b65acbad094685d04eb869ce590c65c2b6" | ||
} |
@@ -100,6 +100,6 @@ (function (global, factory) { | ||
react.useEffect(function () { | ||
setTimeout(function () { | ||
if (ref.current) { | ||
ref.current.focus(); | ||
}, 100); | ||
}, []); | ||
} | ||
}, [ref.current]); | ||
return ref; | ||
@@ -106,0 +106,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(){setTimeout((function(){n.current.focus()}),100)}),[]),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),m=r(t.useState(!1),2),v=m[0],d=m[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||(v&&(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);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})})); |
@@ -18,6 +18,6 @@ "use strict"; | ||
(0, _react.useEffect)(function () { | ||
setTimeout(function () { | ||
if (ref.current) { | ||
ref.current.focus(); | ||
}, 100); | ||
}, []); | ||
} | ||
}, [ref.current]); | ||
return ref; | ||
@@ -24,0 +24,0 @@ }; |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
40353
35
1
59