本文整理汇总了TypeScript中vs/base/common/async.ResourceQueue类的典型用法代码示例。如果您正苦于以下问题:TypeScript ResourceQueue类的具体用法?TypeScript ResourceQueue怎么用?TypeScript ResourceQueue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ResourceQueue类的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
});