本文整理匯總了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
});