export function debounce(func, wait = 3000, immediate = true) { let timeout; return function () { 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 reload(option = {}) { // #ifdef H5 location.reload(); // #endif // #ifdef MP-WEIXIN const pages = getCurrentPages(); const perpage = pages[pages.length - 1]; perpage.onLoad(option); // #endif }