• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lifecycle.combinedDisposable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vs/base/common/lifecycle.combinedDisposable函数的典型用法代码示例。如果您正苦于以下问题:TypeScript combinedDisposable函数的具体用法?TypeScript combinedDisposable怎么用?TypeScript combinedDisposable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了combinedDisposable函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: Menu

				render: (container) => {
					this.menuContainerElement = container;

					let className = delegate.getMenuClassName ? delegate.getMenuClassName() : '';

					if (className) {
						container.className += ' ' + className;
					}

					let menu = new Menu(container, actions, {
						actionItemProvider: delegate.getActionItem,
						context: delegate.getActionsContext ? delegate.getActionsContext() : null,
						actionRunner: this.actionRunner
					});

					let listener1 = menu.addListener(EventType.CANCEL, (e: any) => {
						this.contextViewService.hideContextView(true);
					});

					let listener2 = menu.addListener(EventType.BLUR, (e: any) => {
						this.contextViewService.hideContextView(true);
					});

					menu.focus();

					return combinedDisposable([listener1, listener2, menu]);
				},
开发者ID:SeanKilleen,项目名称:vscode,代码行数:27,代码来源:contextMenuHandler.ts


示例2: ActionRunner

			render: (container) => {
				this.menuContainerElement = container;

				let className = delegate.getMenuClassName ? delegate.getMenuClassName() : '';

				if (className) {
					container.className += ' ' + className;
				}

				const menuDisposables: IDisposable[] = [];

				const actionRunner = delegate.actionRunner || new ActionRunner();
				actionRunner.onDidBeforeRun(this.onActionRun, this, menuDisposables);
				actionRunner.onDidRun(this.onDidActionRun, this, menuDisposables);

				menu = new Menu(container, actions, {
					actionItemProvider: delegate.getActionItem,
					context: delegate.getActionsContext ? delegate.getActionsContext() : null,
					actionRunner,
					getKeyBinding: delegate.getKeyBinding ? delegate.getKeyBinding : action => this.keybindingService.lookupKeybinding(action.id)
				});

				menuDisposables.push(attachMenuStyler(menu, this.themeService));

				menu.onDidCancel(() => this.contextViewService.hideContextView(true), null, menuDisposables);
				menu.onDidBlur(() => this.contextViewService.hideContextView(true), null, menuDisposables);
				domEvent(window, EventType.BLUR)(() => { this.contextViewService.hideContextView(true); }, null, menuDisposables);

				return combinedDisposable([...menuDisposables, menu]);
			},
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:30,代码来源:contextMenuHandler.ts


示例3: createSharedProcessContributions

export function createSharedProcessContributions(service: IInstantiationService): IDisposable {
	return combinedDisposable([
		service.createInstance(NodeCachedDataCleaner),
		service.createInstance(LanguagePackCachedDataCleaner),
		service.createInstance(StorageDataCleaner)
	]);
}
开发者ID:donaldpipowitch,项目名称:vscode,代码行数:7,代码来源:contributions.ts


示例4: ActionRunner

				render: (container) => {
					this.menuContainerElement = container;

					let className = delegate.getMenuClassName ? delegate.getMenuClassName() : '';

					if (className) {
						container.className += ' ' + className;
					}

					const menuDisposables: IDisposable[] = [];

					const actionRunner = delegate.actionRunner || new ActionRunner();
					actionRunner.onDidBeforeRun(this.onActionRun, this, menuDisposables);
					actionRunner.onDidRun(this.onDidActionRun, this, menuDisposables);

					const menu = new Menu(container, actions, {
						actionItemProvider: delegate.getActionItem,
						context: delegate.getActionsContext ? delegate.getActionsContext() : null,
						actionRunner,
						getKeyBinding: delegate.getKeyBinding
					});

					menu.onDidCancel(() => this.contextViewService.hideContextView(true), null, menuDisposables);
					menu.onDidBlur(() => this.contextViewService.hideContextView(true), null, menuDisposables);

					menu.focus(!!delegate.autoSelectFirstItem);

					return combinedDisposable([...menuDisposables, menu]);
				},
开发者ID:developers23,项目名称:vscode,代码行数:29,代码来源:contextMenuHandler.ts


示例5: _registerWorkbenchCommandFromAction

	private _registerWorkbenchCommandFromAction(descriptor: SyncActionDescriptor, alias: string, category?: string): IDisposable {
		let registrations: IDisposable[] = [];

		// command
		registrations.push(CommandsRegistry.registerCommand(descriptor.id, this._createCommandHandler(descriptor)));

		// keybinding
		const when = descriptor.keybindingContext;
		const weight = (typeof descriptor.keybindingWeight === 'undefined' ? KeybindingsRegistry.WEIGHT.workbenchContrib() : descriptor.keybindingWeight);
		const keybindings = descriptor.keybindings;
		KeybindingsRegistry.registerKeybindingRule({
			id: descriptor.id,
			weight: weight,
			when: when,
			primary: keybindings && keybindings.primary,
			secondary: keybindings && keybindings.secondary,
			win: keybindings && keybindings.win,
			mac: keybindings && keybindings.mac,
			linux: keybindings && keybindings.linux
		});

		// menu item
		// TODO@Rob slightly weird if-check required because of
		// https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/search/electron-browser/search.contribution.ts#L266
		if (descriptor.label) {

			let idx = alias.indexOf(': ');
			let categoryOriginal;
			if (idx > 0) {
				categoryOriginal = alias.substr(0, idx);
				alias = alias.substr(idx + 2);
			}

			const command = {
				id: descriptor.id,
				title: { value: descriptor.label, original: alias },
				category: category && { value: category, original: categoryOriginal }
			};

			MenuRegistry.addCommand(command);

			registrations.push(MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command }));
		}

		// TODO@alex,joh
		// support removal of keybinding rule
		// support removal of command-ui
		return combinedDisposable(registrations);
	}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:49,代码来源:actions.ts


示例6: registerWindowDriver

export async function registerWindowDriver(
	client: IPCClient,
	windowId: number,
	instantiationService: IInstantiationService
): TPromise<IDisposable> {
	const windowDriver = instantiationService.createInstance(WindowDriver);
	const windowDriverChannel = new WindowDriverChannel(windowDriver);
	client.registerChannel('windowDriver', windowDriverChannel);

	const windowDriverRegistryChannel = client.getChannel('windowDriverRegistry');
	const windowDriverRegistry = new WindowDriverRegistryChannelClient(windowDriverRegistryChannel);

	await windowDriverRegistry.registerWindowDriver(windowId);

	const disposable = toDisposable(() => windowDriverRegistry.reloadWindowDriver(windowId));
	return combinedDisposable([disposable, client]);
}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:17,代码来源:driver.ts


示例7: ExtensionManagementChannel

		instantiationService2.invokeFunction(accessor => {

			const extensionManagementService = accessor.get(IExtensionManagementService);
			const channel = new ExtensionManagementChannel(extensionManagementService, () => null);
			server.registerChannel('extensions', channel);

			const localizationsService = accessor.get(ILocalizationsService);
			const localizationsChannel = new LocalizationsChannel(localizationsService);
			server.registerChannel('localizations', localizationsChannel);

			// clean up deprecated extensions
			(extensionManagementService as ExtensionManagementService).removeDeprecatedExtensions();
			// update localizations cache
			(localizationsService as LocalizationsService).update();
			// cache clean ups
			disposables.push(combinedDisposable([
				instantiationService2.createInstance(NodeCachedDataCleaner),
				instantiationService2.createInstance(LanguagePackCachedDataCleaner),
				instantiationService2.createInstance(StorageDataCleaner),
				instantiationService2.createInstance(LogsDataCleaner)
			]));
			disposables.push(extensionManagementService as ExtensionManagementService);
		});
开发者ID:joelday,项目名称:vscode,代码行数:23,代码来源:sharedProcessMain.ts


示例8: onClick

	public onClick(callback: (event: MouseEvent) => void): IDisposable {
		return combinedDisposable([
			dom.addDisposableListener(this.labelDescriptionContainer.element, dom.EventType.CLICK, (e: MouseEvent) => callback(e)),
		]);
	}
开发者ID:sameer-coder,项目名称:vscode,代码行数:5,代码来源:iconLabel.ts



注:本文中的vs/base/common/lifecycle.combinedDisposable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lifecycle.dispose函数代码示例发布时间:2022-05-25
下一篇:
TypeScript labels.shorten函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap