本文整理汇总了TypeScript中@dojo/interfaces/core.Handle.destroy方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Handle.destroy方法的具体用法?TypeScript Handle.destroy怎么用?TypeScript Handle.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@dojo/interfaces/core.Handle
的用法示例。
在下文中一共展示了Handle.destroy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _dispatch
protected _dispatch(): void {
this._isProcessing = true;
if (this._task) {
this._task.destroy();
this._task = null;
}
const queue = this._queue;
let item: QueueItem | undefined;
while (item = queue.shift()) {
if (item.isActive && item.callback) {
item.callback();
}
}
this._isProcessing = false;
let deferred: QueueItem[] | null = this._deferred;
if (deferred && deferred.length) {
this._deferred = null;
let item: QueueItem | undefined;
while (item = deferred.shift()) {
this._schedule(item);
}
}
}
示例2: own
/**
* Register handles for the instance that will be destroyed when `this.destroy` is called
*
* @param {Handle} handle The handle to add for the instance
* @returns {Handle} a handle for the handle, removes the handle for the instance and calls destroy
*/
own(handle: Handle): Handle {
const { handles } = this;
handles.push(handle);
return {
destroy() {
handles.splice(handles.indexOf(handle));
handle.destroy();
}
};
}
示例3: afterEach
createTimer: (function () {
let timer: Handle | null;
return {
afterEach() {
timer && timer.destroy();
timer = null;
},
destroy(this: any) {
const dfd = this.async(1000);
const spy = sinon.spy();
timer = util.createTimer(spy, 100);
setTimeout(function () {
if (timer) {
timer.destroy();
}
}, 50);
setTimeout(dfd.callback(function () {
assert.strictEqual(spy.callCount, 0);
}), 110);
},
timeout(this: any) {
const dfd = this.async(1000);
const spy = sinon.spy();
timer = util.createTimer(spy, 100);
setTimeout(dfd.callback(function () {
assert.strictEqual(spy.callCount, 1);
}), 110);
}
};
})(),
示例4: setTimeout
setTimeout(function () {
if (timer) {
timer.destroy();
}
}, 50);
示例5:
).finally(() => {
listenerHandle.destroy();
return this.executor.emit('suiteEnd', this);
});
示例6: function
return function () {
if (handle) {
handle.destroy();
}
return util.cleanup(tunnel);
};