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


TypeScript idGenerator.defaultGenerator類代碼示例

本文整理匯總了TypeScript中vs/base/common/idGenerator.defaultGenerator的典型用法代碼示例。如果您正苦於以下問題:TypeScript defaultGenerator類的具體用法?TypeScript defaultGenerator怎麽用?TypeScript defaultGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了defaultGenerator類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer(lang, code);
			// when code-block rendering is async we return sync
			// but update the node with the real result later.
			const id = defaultGenerator.nextId();

			// {{SQL CARBON EDIT}} - Promise.all not returning the strValue properly in original code?
			const promise = value.then(strValue => {
				withInnerHTML.then(e => {
					const span = element.querySelector(`div[data-code="${id}"]`);
					if (span) {
						span.innerHTML = strValue;
					}
				}).catch(err => {
					// ignore
				});
			});

			// original VS Code source
			// const promise = Promise.all([value, withInnerHTML]).then(values => {
			// 	const strValue = values[0];
			// 	const span = element.querySelector(`div[data-code="${id}"]`);
			// 	if (span) {
			// 		span.innerHTML = strValue;
			// 	}
			// }).catch(err => {
			// 	// ignore
			// });

			if (options.codeBlockRenderCallback) {
				promise.then(options.codeBlockRenderCallback);
			}

			return `<div class="code" data-code="${id}">${escape(code)}</div>`;
		};
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:35,代碼來源:htmlContentRenderer.ts

示例2:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer!(lang, code);
			// when code-block rendering is async we return sync
			// but update the node with the real result later.
			const id = defaultGenerator.nextId();
			const promise = Promise.all([value, withInnerHTML]).then(values => {
				const strValue = values[0];
				const span = element.querySelector(`div[data-code="${id}"]`);
				if (span) {
					span.innerHTML = strValue;
				}
			}).catch(err => {
				// ignore
			});

			if (options.codeBlockRenderCallback) {
				promise.then(options.codeBlockRenderCallback);
			}

			return `<div class="code" data-code="${id}">${escape(code)}</div>`;
		};
開發者ID:DonJayamanne,項目名稱:vscode,代碼行數:21,代碼來源:htmlContentRenderer.ts

示例3:

			renderer.code = (code, lang) => {
				let value = options.codeBlockRenderer(lang, code);
				if (typeof value === 'string') {
					return value;
				}

				if (TPromise.is(value)) {
					// when code-block rendering is async we return sync
					// but update the node with the real result later.
					const id = defaultGenerator.nextId();
					TPromise.join([value, withInnerHTML]).done(values => {
						let [value] = values;
						let span = element.querySelector(`span[data-code="${id}"]`);
						if (span) {
							span.innerHTML = value;
						}
					}, err => {
						// ignore
					});
					return `<span data-code="${id}">${code}</span>`;
				}

				return code;
			};
開發者ID:Magicwalker,項目名稱:vscode,代碼行數:24,代碼來源:htmlContentRenderer.ts

示例4:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer(lang, code);
			if (typeof value === 'string') {
				return value;
			}

			if (TPromise.is(value)) {
				// when code-block rendering is async we return sync
				// but update the node with the real result later.
				const id = defaultGenerator.nextId();
				TPromise.join([value, withInnerHTML]).done(values => {
					const strValue = values[0] as string;
					const span = element.querySelector(`div[data-code="${id}"]`);
					if (span) {
						span.innerHTML = strValue;
					}
				}, err => {
					// ignore
				});
				return `<div class="code" data-code="${id}">${escape(code)}</div>`;
			}

			return code;
		};
開發者ID:gokulakrishna9,項目名稱:vscode,代碼行數:24,代碼來源:htmlContentRenderer.ts

示例5: constructor

	constructor(node: any, provider: TreeExplorerNodeProvider<any>) {
		this.id = defaultGenerator.nextId();
		this.label = provider.getLabel ? provider.getLabel(node) : node.toString();
		this.hasChildren = provider.getHasChildren ? provider.getHasChildren(node) : true;
		this.clickCommand = provider.getClickCommand ? provider.getClickCommand(node) : null;
	}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:6,代碼來源:extHostTreeExplorers.ts


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