export function debounce(func, wait = 3000, immediate = true) { let timeout; return function () { console.log(11112, timeout); const context = this; const args = [...arguments]; if (timeout) clearTimeout(timeout); if (immediate) { const callNow = !timeout; timeout = setTimeout(() => { timeout = null; }, wait); if (callNow) func.apply(context, args); } else { timeout = setTimeout(() => { func.apply(context, args); }, wait); } }; } export function throttle(fn, delay = 1000) { let lastTime = 0; return function () { let _this = this; let _arguments = arguments; let now = new Date().getTime(); if (now - lastTime > delay) { fn.apply(_this, _arguments); lastTime = now; } }; } export function reload(option = {}) { // #ifdef H5 location.reload(); // #endif // #ifdef MP-WEIXIN const pages = getCurrentPages(); const perpage = pages[pages.length - 1]; perpage.onLoad(option); // #endif }