跳至主要内容

命令

commands 模块提供注册和执行命令的函数

示例

import * as api from '@podman-desktop/api';

export async function activate(extensionContext: api.ExtensionContext): Promise<void> {

const myCommand = api.commands.registerCommand(
'extension-name.my-command',
(arg1: string, arg2: number) => {
console.log('my-command executed with', arg1, arg2);
},
);

extensionContext.subscriptions.push(myCommand);

// [...]

api.commands.executeCommand('extension-name.my-command', 'a-string', 1001);
}

索引

函数