本文整理匯總了TypeScript中core/signaling.Signal.connect方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Signal.connect方法的具體用法?TypeScript Signal.connect怎麽用?TypeScript Signal.connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core/signaling.Signal
的用法示例。
在下文中一共展示了Signal.connect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should support `{dis}connect()` method", () => {
const signal = new Signal(Object.create(null), "some")
let signaled: number = 0
const fn = (val: number) => signaled = val
expect(signal.connect(fn)).to.be.equal(true)
expect(signal.connect(fn)).to.be.equal(false)
expect(signaled).to.be.equal(0)
signal.emit(1)
expect(signaled).to.be.equal(1)
signal.emit(2)
expect(signaled).to.be.equal(2)
expect(signal.disconnect(fn)).to.be.equal(true)
expect(signal.disconnect(fn)).to.be.equal(false)
signal.emit(3)
expect(signaled).to.be.equal(2)
})
示例2: initialize
initialize(options: any): void {
this.pause();
super.initialize(options);
this._tiles_loaded = false;
this.zoom_count = 0;
const mo = this.model.plot.map_options;
this.initial_zoom = mo.zoom;
this.initial_lat = mo.lat;
this.initial_lng = mo.lng;
this.canvas_view.map_el.style.position = "absolute";
if (((window.google != null ? window.google.maps : undefined) == null)) {
if ((window._bokeh_gmaps_callback == null)) {
load_google_api(this.model.plot.api_key);
}
gmaps_ready.connect(() => this.request_render());
}
this.unpause();
}