throttle static method
节流 (传入所要节流的方法/回调与延迟时间)
Implementation
static void throttle(Function func, [int delay = 500]) {
if (_throttleFlag) {
func.call();
_throttleFlag = false;
return;
}
if (_throttleTimer != null) {
return;
}
_throttleTimer = Timer(Duration(milliseconds: delay), () {
func.call();
_throttleTimer = null;
});
}