本文整理汇总了TypeScript中vs/base/common/async.ResourceQueue.queueFor方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ResourceQueue.queueFor方法的具体用法?TypeScript ResourceQueue.queueFor怎么用?TypeScript ResourceQueue.queueFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/base/common/async.ResourceQueue
的用法示例。
在下文中一共展示了ResourceQueue.queueFor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('ResourceQueue - simple', function () {
let queue = new Async.ResourceQueue();
const r1Queue = queue.queueFor(URI.file('/some/path'));
const r2Queue = queue.queueFor(URI.file('/some/other/path'));
assert.ok(r1Queue);
assert.ok(r2Queue);
assert.equal(r1Queue, queue.queueFor(URI.file('/some/path'))); // same queue returned
let syncPromiseFactory = () => TPromise.as(true);
r1Queue.queue(syncPromiseFactory);
const r1Queue2 = queue.queueFor(URI.file('/some/path'));
assert.notEqual(r1Queue, r1Queue2); // previous one got disposed after finishing
});
示例2: test
test('ResourceQueue - simple', function () {
let queue = new async.ResourceQueue();
const r1Queue = queue.queueFor(URI.file('/some/path'));
r1Queue.onFinished(() => console.log('DONE'));
const r2Queue = queue.queueFor(URI.file('/some/other/path'));
assert.ok(r1Queue);
assert.ok(r2Queue);
assert.equal(r1Queue, queue.queueFor(URI.file('/some/path'))); // same queue returned
let syncPromiseFactory = () => Promise.resolve(null);
r1Queue.queue(syncPromiseFactory);
return new Promise(c => setTimeout(() => c(), 0)).then(() => {
const r1Queue2 = queue.queueFor(URI.file('/some/path'));
assert.notEqual(r1Queue, r1Queue2); // previous one got disposed after finishing
});
});
示例3: Promise
return new Promise(c => setTimeout(() => c(), 0)).then(() => {
const r1Queue2 = queue.queueFor(URI.file('/some/path'));
assert.notEqual(r1Queue, r1Queue2); // previous one got disposed after finishing
});