freeze-click
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -0,1 +1,16 @@ | ||
# [1.2.0](https://github.com/bugszhou/freeze-click/compare/v1.0.7...v1.2.0) (2020-05-18) | ||
### Bug Fixes | ||
* Set wait time ([1994cda](https://github.com/bugszhou/freeze-click/commit/1994cda1705b5777ff7bd3269ba566ffb1cdb073)) | ||
### Features | ||
* Add setWaitTime ([71bd23c](https://github.com/bugszhou/freeze-click/commit/71bd23c7906264b135c31e25bb4c89f776e112d0)) | ||
* 增加setWaitTime ([bf4bf5b](https://github.com/bugszhou/freeze-click/commit/bf4bf5b7c3b4036fc964dc32995be2cb0742aa24)) | ||
<a name="1.1.2"></a> | ||
@@ -2,0 +17,0 @@ ## [1.1.2](https://github.com/bugszhou/freeze-click/compare/v1.1.0...v1.1.2) (2019-09-18) |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self,function(){var n=t["freeze-click"],i=t["freeze-click"]=e();i.noConflict=function(){return t["freeze-click"]=n,i}}())}(this,function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e="Expected a function",n=NaN,i="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,a="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,d=a||l||Function("return this")(),s=Object.prototype.toString,p=Math.max,v=Math.min,y=function(){return d.Date.now()};function b(t,n,i){var r,o,f,u,c,a,l=0,d=!1,s=!1,b=!0;if("function"!=typeof t)throw new TypeError(e);function h(e){var n=r,i=o;return r=o=void 0,l=e,u=t.apply(i,n)}function j(t){var e=t-a;return void 0===a||e>=n||e<0||s&&t-l>=f}function w(){var t=y();if(j(t))return T(t);c=setTimeout(w,function(t){var e=n-(t-a);return s?v(e,f-(t-l)):e}(t))}function T(t){return c=void 0,b&&r?h(t):(r=o=void 0,u)}function x(){var t=y(),e=j(t);if(r=arguments,o=this,a=t,e){if(void 0===c)return function(t){return l=t,c=setTimeout(w,n),d?h(t):u}(a);if(s)return c=setTimeout(w,n),h(a)}return void 0===c&&(c=setTimeout(w,n)),u}return n=m(n)||0,g(i)&&(d=!!i.leading,f=(s="maxWait"in i)?p(m(i.maxWait)||0,n):f,b="trailing"in i?!!i.trailing:b),x.cancel=function(){void 0!==c&&clearTimeout(c),l=0,r=a=o=c=void 0},x.flush=function(){return void 0===c?u:T(y())},x}function g(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&s.call(t)==i}(t))return n;if(g(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=g(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var a=f.test(t);return a||u.test(t)?c(t.slice(2),a?2:8):o.test(t)?n:+t}var h=function(t,n,i){var r=!0,o=!0;if("function"!=typeof t)throw new TypeError(e);return g(i)&&(r="leading"in i?!!i.leading:r,o="trailing"in i?!!i.trailing:o),b(t,n,{leading:r,maxWait:n,trailing:o})},j=1e4;return function(t,e){var n=h(t,e||0===e?e:j,{trailing:!1});return function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.call.apply(n,[this,n].concat(e))}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e=e||self,function(){var n=e["freeze-click"],i=e["freeze-click"]={};t(i),i.noConflict=function(){return e["freeze-click"]=n,i}}())}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,r=/^0o[0-7]+$/i,f=parseInt,u="object"==typeof t&&t&&t.Object===Object&&t,a="object"==typeof self&&self&&self.Object===Object&&self,c=u||a||Function("return this")(),l=Object.prototype.toString,d=Math.max,s=Math.min,p=function(){return c.Date.now()};function v(e,t,n){var i,o,r,f,u,a,c=0,l=!1,v=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=i,r=o;return i=o=void 0,c=t,f=e.apply(r,n)}function h(e){return c=e,u=setTimeout(x,t),l?m(e):f}function j(e){var n=e-a;return void 0===a||n>=t||n<0||v&&e-c>=r}function x(){var e=p();if(j(e))return T(e);u=setTimeout(x,function(e){var n=t-(e-a);return v?s(n,r-(e-c)):n}(e))}function T(e){return u=void 0,g&&i?m(e):(i=o=void 0,f)}function w(){var e=p(),n=j(e);if(i=arguments,o=this,a=e,n){if(void 0===u)return h(a);if(v)return u=setTimeout(x,t),m(a)}return void 0===u&&(u=setTimeout(x,t)),f}return t=b(t)||0,y(n)&&(l=!!n.leading,r=(v="maxWait"in n)?d(b(n.maxWait)||0,t):r,g="trailing"in n?!!n.trailing:g),w.cancel=function(){void 0!==u&&clearTimeout(u),c=0,i=a=o=u=void 0},w.flush=function(){return void 0===u?f:T(p())},w}function y(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function b(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==l.call(e)}(e))return NaN;if(y(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=y(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var u=o.test(e);return u||r.test(e)?f(e.slice(2),u?2:8):i.test(e)?NaN:+e}var g=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return y(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),v(e,t,{leading:i,maxWait:t,trailing:o})},m=1e4;var h=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1e4;m=e};e.default=function(e,t){var n=g(e,t||0===t?t:m,{trailing:!1});return function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];n.call.apply(n,[this,n].concat(t))}},e.setWaitTime=h,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=freeze-click.common.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, (function () { | ||
var current = global['freeze-click']; | ||
var exports = global['freeze-click'] = factory(); | ||
var exports = global['freeze-click'] = {}; | ||
factory(exports); | ||
exports.noConflict = function () { global['freeze-click'] = current; return exports; }; | ||
}())); | ||
}(this, function () { 'use strict'; | ||
}(this, function (exports) { 'use strict'; | ||
@@ -453,7 +454,12 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var waitTime=1e3*10;function freezeClick(cb,wait){var time=1e3*10;time=wait||0===wait?wait:waitTime;var t=lodash_throttle(cb,time,{trailing:!1});return function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];t.call.apply(t,[this,t].concat(args));}} | ||
var waitTime=1e3*10;function setWaitTime(){var wait=0<arguments.length&&arguments[0]!==void 0?arguments[0]:1e3*10;waitTime=wait;}function freezeClick(cb,wait){var time=1e3*10;time=wait||0===wait?wait:waitTime;var t=lodash_throttle(cb,time,{trailing:!1});return function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];t.call.apply(t,[this,t].concat(args));}} | ||
return freezeClick; | ||
var setWaitTime$1=setWaitTime; | ||
exports.default = freezeClick; | ||
exports.setWaitTime = setWaitTime$1; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); | ||
//# sourceMappingURL=freeze-click.dev.js.map |
@@ -443,5 +443,8 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var waitTime=1e3*10;function freezeClick(cb,wait){var time=1e3*10;time=wait||0===wait?wait:waitTime;var t=lodash_throttle(cb,time,{trailing:!1});return function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];t.call.apply(t,[this,t].concat(args));}} | ||
var waitTime=1e3*10;function setWaitTime(){var wait=0<arguments.length&&arguments[0]!==void 0?arguments[0]:1e3*10;waitTime=wait;}function freezeClick(cb,wait){var time=1e3*10;time=wait||0===wait?wait:waitTime;var t=lodash_throttle(cb,time,{trailing:!1});return function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];t.call.apply(t,[this,t].concat(args));}} | ||
var setWaitTime$1=setWaitTime; | ||
export default freezeClick; | ||
export { setWaitTime$1 as setWaitTime }; | ||
//# sourceMappingURL=freeze-click.esm.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, (function () { | ||
var current = global['freeze-click']; | ||
var exports = global['freeze-click'] = factory(); | ||
var exports = global['freeze-click'] = {}; | ||
factory(exports); | ||
exports.noConflict = function () { global['freeze-click'] = current; return exports; }; | ||
}())); | ||
}(this, function () { 'use strict'; | ||
}(this, function (exports) { 'use strict'; | ||
@@ -453,7 +454,12 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var waitTime=1e3*10;function freezeClick(cb,wait){var time=1e3*10;time=wait||0===wait?wait:waitTime;var t=lodash_throttle(cb,time,{trailing:!1});return function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];t.call.apply(t,[this,t].concat(args));}} | ||
var waitTime=1e3*10;function setWaitTime(){var wait=0<arguments.length&&arguments[0]!==void 0?arguments[0]:1e3*10;waitTime=wait;}function freezeClick(cb,wait){var time=1e3*10;time=wait||0===wait?wait:waitTime;var t=lodash_throttle(cb,time,{trailing:!1});return function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];t.call.apply(t,[this,t].concat(args));}} | ||
return freezeClick; | ||
var setWaitTime$1=setWaitTime; | ||
exports.default = freezeClick; | ||
exports.setWaitTime = setWaitTime$1; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); | ||
//# sourceMappingURL=freeze-click.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self,function(){var n=t["freeze-click"],i=t["freeze-click"]=e();i.noConflict=function(){return t["freeze-click"]=n,i}}())}(this,function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e="Expected a function",n=NaN,i="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,a="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,d=a||l||Function("return this")(),s=Object.prototype.toString,p=Math.max,v=Math.min,y=function(){return d.Date.now()};function b(t,n,i){var r,o,f,u,c,a,l=0,d=!1,s=!1,b=!0;if("function"!=typeof t)throw new TypeError(e);function h(e){var n=r,i=o;return r=o=void 0,l=e,u=t.apply(i,n)}function j(t){var e=t-a;return void 0===a||e>=n||e<0||s&&t-l>=f}function w(){var t=y();if(j(t))return T(t);c=setTimeout(w,function(t){var e=n-(t-a);return s?v(e,f-(t-l)):e}(t))}function T(t){return c=void 0,b&&r?h(t):(r=o=void 0,u)}function x(){var t=y(),e=j(t);if(r=arguments,o=this,a=t,e){if(void 0===c)return function(t){return l=t,c=setTimeout(w,n),d?h(t):u}(a);if(s)return c=setTimeout(w,n),h(a)}return void 0===c&&(c=setTimeout(w,n)),u}return n=m(n)||0,g(i)&&(d=!!i.leading,f=(s="maxWait"in i)?p(m(i.maxWait)||0,n):f,b="trailing"in i?!!i.trailing:b),x.cancel=function(){void 0!==c&&clearTimeout(c),l=0,r=a=o=c=void 0},x.flush=function(){return void 0===c?u:T(y())},x}function g(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&s.call(t)==i}(t))return n;if(g(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=g(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var a=f.test(t);return a||u.test(t)?c(t.slice(2),a?2:8):o.test(t)?n:+t}var h=function(t,n,i){var r=!0,o=!0;if("function"!=typeof t)throw new TypeError(e);return g(i)&&(r="leading"in i?!!i.leading:r,o="trailing"in i?!!i.trailing:o),b(t,n,{leading:r,maxWait:n,trailing:o})},j=1e4;return function(t,e){var n=h(t,e||0===e?e:j,{trailing:!1});return function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n.call.apply(n,[this,n].concat(e))}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e=e||self,function(){var n=e["freeze-click"],i=e["freeze-click"]={};t(i),i.noConflict=function(){return e["freeze-click"]=n,i}}())}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,r=/^0o[0-7]+$/i,f=parseInt,u="object"==typeof t&&t&&t.Object===Object&&t,a="object"==typeof self&&self&&self.Object===Object&&self,c=u||a||Function("return this")(),l=Object.prototype.toString,d=Math.max,s=Math.min,p=function(){return c.Date.now()};function v(e,t,n){var i,o,r,f,u,a,c=0,l=!1,v=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=i,r=o;return i=o=void 0,c=t,f=e.apply(r,n)}function h(e){return c=e,u=setTimeout(x,t),l?m(e):f}function j(e){var n=e-a;return void 0===a||n>=t||n<0||v&&e-c>=r}function x(){var e=p();if(j(e))return T(e);u=setTimeout(x,function(e){var n=t-(e-a);return v?s(n,r-(e-c)):n}(e))}function T(e){return u=void 0,g&&i?m(e):(i=o=void 0,f)}function w(){var e=p(),n=j(e);if(i=arguments,o=this,a=e,n){if(void 0===u)return h(a);if(v)return u=setTimeout(x,t),m(a)}return void 0===u&&(u=setTimeout(x,t)),f}return t=b(t)||0,y(n)&&(l=!!n.leading,r=(v="maxWait"in n)?d(b(n.maxWait)||0,t):r,g="trailing"in n?!!n.trailing:g),w.cancel=function(){void 0!==u&&clearTimeout(u),c=0,i=a=o=u=void 0},w.flush=function(){return void 0===u?f:T(p())},w}function y(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function b(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==l.call(e)}(e))return NaN;if(y(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=y(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var u=o.test(e);return u||r.test(e)?f(e.slice(2),u?2:8):i.test(e)?NaN:+e}var g=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return y(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),v(e,t,{leading:i,maxWait:t,trailing:o})},m=1e4;var h=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1e4;m=e};e.default=function(e,t){var n=g(e,t||0===t?t:m,{trailing:!1});return function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];n.call.apply(n,[this,n].concat(t))}},e.setWaitTime=h,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=freeze-click.min.js.map |
{ | ||
"name": "freeze-click", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "防止多次点击", | ||
@@ -30,4 +30,5 @@ "author": "bugszhou | Email:bugszhou@outlook.com", | ||
"unhusky": "node node_modules/husky/lib/installer/bin uninstall", | ||
"postversion": "ziu cl -p angular -i CHANGELOG.md -s -r 1000 && git add CHANGELOG.md package.json && git add -u", | ||
"commit": "ziu commit", | ||
"cl": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1000", | ||
"postversion": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2 && git add CHANGELOG.md package.json && git add -u", | ||
"commit": "git-cz", | ||
"prepublishOnly": "npm run build" | ||
@@ -53,2 +54,3 @@ }, | ||
"commitlint": "^8.1.0", | ||
"conventional-changelog-cli": "^2.0.31", | ||
"eslint": "^6.0.1", | ||
@@ -59,2 +61,3 @@ "eslint-config-airbnb": "^17.1.1", | ||
"eslint-plugin-react": "^7.14.2", | ||
"git-cz": "^3.3.0", | ||
"husky": "^3.0.0", | ||
@@ -68,4 +71,3 @@ "jest": "^24.9.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"ziu": "^1.6.0" | ||
"rollup-plugin-terser": "^5.3.0" | ||
}, | ||
@@ -72,0 +74,0 @@ "license": "MIT", |
@@ -10,3 +10,3 @@ ## freeze-click | ||
* 默认冻结60s,60s内只请求一次,需要手动调用`cancel`取消冻结才能发送第二次请求。未调用`cancel`将在60s后自动释放。 | ||
* 默认冻结10s,10s内只请求一次,需要手动调用`cancel`取消冻结才能发送第二次请求。未调用`cancel`将在60s后自动释放。 | ||
@@ -74,1 +74,11 @@ 1. install | ||
(Function): 冻结后的函数 | ||
### setWaitTime(wait = 10 * 1000) | ||
修改冻结时间 | ||
```javascript | ||
import {setWaitTime} from 'freeze-click'; | ||
setWaitTime(500); | ||
``` |
@@ -1,3 +0,5 @@ | ||
import { freezeClick } from '../lib/index'; | ||
import { freezeClick, setWaitTime as setWaitTimeFn } from "../lib/index"; | ||
export const setWaitTime = setWaitTimeFn; | ||
export default freezeClick; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
165176
1428
83
28
1