本文整理汇总了TypeScript中vs/base/common/lifecycle.dispose函数的典型用法代码示例。如果您正苦于以下问题:TypeScript dispose函数的具体用法?TypeScript dispose怎么用?TypeScript dispose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dispose函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: teardown
teardown(() => {
dispose(disposables);
disposables = [];
});
开发者ID:ramesius,项目名称:vscode,代码行数:4,代码来源:model.test.ts
示例2: dispose
const onExit = () => dispose(disposables);
开发者ID:felipecaputo,项目名称:vscode,代码行数:1,代码来源:sharedProcessMain.ts
示例3: dispose
}).setHandler(extensions => {
// remove all previous menu registrations
_menuRegistrations = dispose(_menuRegistrations);
for (let extension of extensions) {
const { value, collector } = extension;
forEach(value, entry => {
if (!schema.isValidMenuItems(entry.value, collector)) {
return;
}
const menu = schema.parseMenuId(entry.key);
if (typeof menu !== 'number') {
collector.warn(localize('menuId.invalid', "`{0}` is not a valid menu identifier", entry.key));
return;
}
if (schema.isProposedAPI(menu) && !extension.description.enableProposedApi) {
collector.error(localize('proposedAPI.invalid', "{0} is a proposed menu identifier and is only available when running out of dev or with the following command line switch: --enable-proposed-api {1}", entry.key, extension.description.identifier.value));
return;
}
for (let item of entry.value) {
let command = MenuRegistry.getCommand(item.command);
let alt = item.alt && MenuRegistry.getCommand(item.alt);
if (!command) {
collector.error(localize('missing.command', "Menu item references a command `{0}` which is not defined in the 'commands' section.", item.command));
continue;
}
if (item.alt && !alt) {
collector.warn(localize('missing.altCommand', "Menu item references an alt-command `{0}` which is not defined in the 'commands' section.", item.alt));
}
if (item.command === item.alt) {
collector.info(localize('dupe.command', "Menu item references the same command as default and alt-command"));
}
let group: string | undefined;
let order: number | undefined;
if (item.group) {
const idx = item.group.lastIndexOf('@');
if (idx > 0) {
group = item.group.substr(0, idx);
order = Number(item.group.substr(idx + 1)) || undefined;
} else {
group = item.group;
}
}
const registration = MenuRegistry.appendMenuItem(menu, {
command,
alt,
group,
order,
when: ContextKeyExpr.deserialize(item.when)
} as IMenuItem);
_menuRegistrations.push(registration);
}
});
}
});
开发者ID:eamodio,项目名称:vscode,代码行数:63,代码来源:menusExtensionPoint.ts
示例4: dispose
public dispose(): void {
this._isDisposed = true;
this._toDispose = dispose(this._toDispose);
}
开发者ID:iiunknown,项目名称:vscode,代码行数:4,代码来源:findModel.ts
示例5: teardown
teardown(function () {
dispose(disposables);
});
开发者ID:asotog,项目名称:vscode,代码行数:3,代码来源:menuService.test.ts
示例6: dispose
public dispose(): void {
this.toDispose = dispose(this.toDispose);
}
开发者ID:asotog,项目名称:vscode,代码行数:3,代码来源:scrollManager.ts
示例7: dispose
return service.executeCommand('farboo').then(() => {
assert.equal(callCounter, 1);
assert.deepEqual(events.sort(), ['*', 'onCommand:farboo'].sort());
dispose(dispoables);
});
开发者ID:joelday,项目名称:vscode,代码行数:5,代码来源:commandService.test.ts
示例8: dispose
dispose(): void {
this.toDispose = dispose(this.toDispose);
super.dispose();
}
开发者ID:asotog,项目名称:vscode,代码行数:4,代码来源:gitModel.ts
示例9: dispose
process.once('exit', () => dispose(disposables));
开发者ID:DonJayamanne,项目名称:vscode,代码行数:1,代码来源:sharedProcessMain.ts
示例10: setup
setup(function () {
disposables = dispose(disposables);
model = Model.createFromString('abc def', undefined, undefined, URI.parse('test:somefile.ttt'));
disposables.push(model);
});
开发者ID:SeanKilleen,项目名称:vscode,代码行数:5,代码来源:suggestModel.test.ts
注:本文中的vs/base/common/lifecycle.dispose函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论