Polymer 聚合物3.0中的去抖器
如何在聚合物3中正确写入去抖动器 据 这很好,但我需要配置一些时间。例如,这就是我在聚合物1中所做的Polymer 聚合物3.0中的去抖器,polymer,polymer-3.x,Polymer,Polymer 3.x,如何在聚合物3中正确写入去抖动器 据 这很好,但我需要配置一些时间。例如,这就是我在聚合物1中所做的 this.debounce("scroll",function() { this.$$("#scrollThreshold").clearTriggers(); }.bind(this), 400); 和聚合物2 this._debouncer = Polymer.Debouncer.debounce( this._debouncer, // initially u
this.debounce("scroll",function() {
this.$$("#scrollThreshold").clearTriggers();
}.bind(this), 400);
和聚合物2
this._debouncer = Polymer.Debouncer.debounce(
this._debouncer, // initially undefined
Polymer.Async.timeOut.after(400),
() => {
// some code
}
);
但是我不知道如何在Polymer 3中设置400ms去抖动异步
模块具有超时
功能,但您需要导入它
import {timeOut} from '@polymer/polymer/lib/utils/async.js';
this._debouncer = Debouncer.debounce(
this._debouncer, // initially undefined
timeOut.after(400),
() => {
// some code
}
);
import {timeOut} from '@polymer/polymer/lib/utils/async.js';
this._debouncer = Debouncer.debounce(
this._debouncer, // initially undefined
timeOut.after(400),
() => {
// some code
}
);