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