本文整理汇总了TypeScript中vs/workbench/api/electron-browser/mainThreadCommands.MainThreadCommands类的典型用法代码示例。如果您正苦于以下问题:TypeScript MainThreadCommands类的具体用法?TypeScript MainThreadCommands怎么用?TypeScript MainThreadCommands使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MainThreadCommands类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('dispose on unregister', function () {
const commands = new MainThreadCommands(SingleProxyRPCProtocol(null), undefined);
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
// register
commands.$registerCommand('foo');
assert.ok(CommandsRegistry.getCommand('foo'));
// unregister
commands.$unregisterCommand('foo');
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
});
示例2: test
test('unregister all on dispose', function () {
const commands = new MainThreadCommands(OneGetThreadService(null), undefined);
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
commands.$registerCommand('foo');
commands.$registerCommand('bar');
assert.ok(CommandsRegistry.getCommand('foo'));
assert.ok(CommandsRegistry.getCommand('bar'));
commands.dispose();
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
assert.equal(CommandsRegistry.getCommand('bar'), undefined);
});
示例3: test
test('unregister all on dispose', function () {
const commands = new MainThreadCommands(SingleProxyRPCProtocol(null), undefined!);
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
commands.$registerCommand('foo');
commands.$registerCommand('bar');
assert.ok(CommandsRegistry.getCommand('foo'));
assert.ok(CommandsRegistry.getCommand('bar'));
commands.dispose();
assert.equal(CommandsRegistry.getCommand('foo'), undefined);
assert.equal(CommandsRegistry.getCommand('bar'), undefined);
});