當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript async.ResourceQueue類代碼示例

本文整理匯總了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
	});
開發者ID:liunian,項目名稱:vscode,代碼行數:17,代碼來源:async.test.ts

示例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
		});
	});
開發者ID:,項目名稱:,代碼行數:22,代碼來源:

示例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
		});
開發者ID:,項目名稱:,代碼行數:4,代碼來源:


注:本文中的vs/base/common/async.ResourceQueue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。