quick-methods
Advanced tools
Comparing version 0.0.7 to 0.0.9
@@ -105,8 +105,14 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/* harmony import */ var _Number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); | ||
/* harmony import */ var _Base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6); | ||
/* harmony import */ var _Dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7); | ||
/* harmony default export */ __webpack_exports__["default"] = ({ | ||
..._String__WEBPACK_IMPORTED_MODULE_0__["default"], | ||
..._Number__WEBPACK_IMPORTED_MODULE_1__["default"] | ||
..._Number__WEBPACK_IMPORTED_MODULE_1__["default"], | ||
..._Base__WEBPACK_IMPORTED_MODULE_2__["default"], | ||
..._Dom__WEBPACK_IMPORTED_MODULE_3__["default"], | ||
}); | ||
@@ -265,4 +271,73 @@ | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
function debounce(fn, time) { | ||
let t = new Date().getTime(); | ||
let first = true; | ||
return async function() { | ||
let newTime = new Date().getTime() | ||
if (newTime - t > time || first) { | ||
first = false; | ||
await fn(...arguments); | ||
t = newTime; | ||
} | ||
}; | ||
} | ||
/* harmony default export */ __webpack_exports__["default"] = ({ | ||
debounce | ||
}); | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */ var _Base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); | ||
function loadFn(fn) { | ||
let loading = false; | ||
async function load() { | ||
if (loading === true) { | ||
return true; | ||
} | ||
loading = true; | ||
await fn(...arguments); | ||
loading = false; | ||
} | ||
return load; | ||
} | ||
async function scrollShare(el, fn, diff = 100) { | ||
let height = el.offsetHeight; | ||
let scrollTop = el.scrollTop; | ||
let wrap = el.children[0]; | ||
let wrapHeight = wrap.offsetHeight; | ||
let diffHeight = wrapHeight - height; | ||
if (diffHeight - scrollTop <= diff) { | ||
await fn(...arguments); | ||
} | ||
} | ||
function scrollHandle(sm = 20) { | ||
return _Base__WEBPACK_IMPORTED_MODULE_0__["default"].debounce(loadFn(scrollShare), sm); | ||
} | ||
let bindScroll = scrollHandle(); | ||
/* harmony default export */ __webpack_exports__["default"] = ({ | ||
bindScroll | ||
}); | ||
/***/ }) | ||
/******/ ])["default"]; | ||
}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["quick-methods"]=t():e["quick-methods"]=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var u=t[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,n),u.l=!0,u.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)n.d(r,u,function(t){return e[t]}.bind(null,u));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r=n(1),u=n(4);t.default={...r.default,...u.default}},function(e,t,n){"use strict";n.r(t);var r=n(2),u=n(3);t.default={copy:r.default,insertAtCursor:u.default}},function(e,t,n){"use strict";n.r(t),t.default=function(e){if("string"!=typeof e)return!1;let t=null;return null===(t=document.getElementById("quick-input-select"))&&((t=document.createElement("input")).type="text",t.id="quick-input-select"),t.style.left="-1000px",t.style.position="absolute",document.body.appendChild(t),t.value=e,t.select(),!!document.execCommand&&document.execCommand("copy")}},function(e,t,n){"use strict";n.r(t),t.default=function(e,t,n){if(e.selectionStart||0===e.selectionStart){var r=e.selectionStart,u=e.selectionEnd,o=u-r;t=t.substring(0,r)+n+t.substring(u,t.length),setTimeout(()=>{e.focus();var t=u+n.length-o;e.setSelectionRange(t,t)})}else t+=n,e.focus();return t}},function(e,t,n){"use strict";n.r(t);var r=n(5);t.default={...r.default}},function(e,t,n){"use strict";function r(e){if("string"==typeof e&&(e=Number(e)),"number"!=typeof e||!0===isNaN(e))return"0";var t=Number(e/100),n=t.toFixed(0),r=t.toFixed(1),u=t.toFixed(2);return Number(n)==Number(r)&&Number(r)==Number(u)?n:Number(n)!=Number(r)&&Number(r)==Number(u)?r:u}n.r(t),t.default={formatPrice:function(e,t="¥ "){return t+r(e)},filterPrice:r}}]).default})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["quick-methods"]=t():e["quick-methods"]=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var u=t[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,n),u.l=!0,u.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)n.d(r,u,function(t){return e[t]}.bind(null,u));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r=n(1),u=n(4),o=n(6),i=n(7);t.default={...r.default,...u.default,...o.default,...i.default}},function(e,t,n){"use strict";n.r(t);var r=n(2),u=n(3);t.default={copy:r.default,insertAtCursor:u.default}},function(e,t,n){"use strict";n.r(t),t.default=function(e){if("string"!=typeof e)return!1;let t=null;return null===(t=document.getElementById("quick-input-select"))&&((t=document.createElement("input")).type="text",t.id="quick-input-select"),t.style.left="-1000px",t.style.position="absolute",document.body.appendChild(t),t.value=e,t.select(),!!document.execCommand&&document.execCommand("copy")}},function(e,t,n){"use strict";n.r(t),t.default=function(e,t,n){if(e.selectionStart||0===e.selectionStart){var r=e.selectionStart,u=e.selectionEnd,o=u-r;t=t.substring(0,r)+n+t.substring(u,t.length),setTimeout(()=>{e.focus();var t=u+n.length-o;e.setSelectionRange(t,t)})}else t+=n,e.focus();return t}},function(e,t,n){"use strict";n.r(t);var r=n(5);t.default={...r.default}},function(e,t,n){"use strict";function r(e){if("string"==typeof e&&(e=Number(e)),"number"!=typeof e||!0===isNaN(e))return"0";var t=Number(e/100),n=t.toFixed(0),r=t.toFixed(1),u=t.toFixed(2);return Number(n)==Number(r)&&Number(r)==Number(u)?n:Number(n)!=Number(r)&&Number(r)==Number(u)?r:u}n.r(t),t.default={formatPrice:function(e,t="¥ "){return t+r(e)},filterPrice:r}},function(e,t,n){"use strict";n.r(t),t.default={debounce:function(e,t){let n=(new Date).getTime(),r=!0;return async function(){let u=(new Date).getTime();(u-n>t||r)&&(r=!1,await e(...arguments),n=u)}}}},function(e,t,n){"use strict";n.r(t);var r=n(6);async function u(e,t,n=100){let r=e.offsetHeight,u=e.scrollTop;e.children[0].offsetHeight-r-u<=n&&await t(...arguments)}let o=function(e=20){return r.default.debounce(function(e){let t=!1;return async function(){if(!0===t)return!0;t=!0,await e(...arguments),t=!1}}(u),e)}();t.default={bindScroll:o}}]).default})); |
import stringM from './String' | ||
import numberM from './Number' | ||
import Base from './Base' | ||
import Dom from './Dom' | ||
export default { | ||
...stringM, | ||
...numberM | ||
...numberM, | ||
...Base, | ||
...Dom, | ||
} |
{ | ||
"name": "quick-methods", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "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
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
27348
29
615