本文整理匯總了TypeScript中core/util/throttle.throttle函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript throttle函數的具體用法?TypeScript throttle怎麽用?TypeScript throttle使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了throttle函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: initialize
initialize(options: any): void {
this.pause();
super.initialize(options);
this.force_paint = new Signal(this, "force_paint");
this.state_changed = new Signal(this, "state_changed");
this.lod_started = false;
this.visuals = new Visuals(this.model.plot);
this._initial_state_info = {
range: null, // set later by set_initial_range()
selection: {}, // XXX: initial selection?
dimensions: {
width: this.model.canvas._width.value,
height: this.model.canvas._height.value,
},
};
this.state = {history: [], index: -1}
// compat, to be removed
this.frame = this.model.frame;
this.canvas = this.model.canvas;
this.canvas_view = new this.canvas.default_view({model: this.canvas, parent: this});
this.el.appendChild(this.canvas_view.el);
this.canvas_view.render();
// If requested, try enabling webgl
if (this.model.plot.output_backend === "webgl") {
this.init_webgl();
}
this.throttled_paint = throttle((() => this.force_paint.emit(undefined)), 15); // TODO (bev) configurable
this.ui_event_bus = new UIEvents(this, this.model.toolbar, this.canvas_view.el, this.model.plot);
this.levels = {};
for (const level of enums.RenderLevel) {
this.levels[level] = {};
}
this.renderer_views = {};
this.tool_views = {};
this.build_levels();
this.build_tools();
this.update_dataranges();
this.unpause(true);
logger.debug("PlotView initialized");
}
示例2: initialize
initialize(options: any): void {
this.pause()
super.initialize(options)
this.force_paint = new Signal0(this, "force_paint")
this.state_changed = new Signal0(this, "state_changed")
this.lod_started = false
this.visuals = new Visuals(this.model.plot) as any // XXX
this._initial_state_info = {
selection: {}, // XXX: initial selection?
dimensions: {
width: this.model.canvas._width.value,
height: this.model.canvas._height.value,
},
}
this.state = {history: [], index: -1}
this.canvas_view = new this.canvas.default_view({model: this.canvas, parent: this}) as CanvasView
this.el.appendChild(this.canvas_view.el)
this.canvas_view.render()
// If requested, try enabling webgl
if (this.model.plot.output_backend == "webgl")
this.init_webgl()
this.throttled_paint = throttle((() => this.force_paint.emit()), 15) // TODO (bev) configurable
this.ui_event_bus = new UIEvents(this, this.model.toolbar, this.canvas_view.el, this.model.plot)
this.levels = {}
for (const level of enums.RenderLevel) {
this.levels[level] = {}
}
this.renderer_views = {}
this.tool_views = {}
this.build_levels()
this.build_tools()
this.update_dataranges()
this.unpause(true)
logger.debug("PlotView initialized")
}