const _my = require("../../__antmove/api/index.js")(my); const wx = _my; const throttle = function(func, duration, show = true) { let start = 0; return function() { let that = this; let now = Date.now(); if (now - start > duration) { func.apply(that, arguments); start = now; } else { if(!show) { return } wx.showToast({ title: `您的操作太频繁啦,请在${Math.ceil( duration / 1000 )}秒后再试哦~`, icon: "none" }); } }; }; module.exports = { throttle };