silverbullet/plug-api/silverbullet-syscall/system.ts

25 lines
626 B
TypeScript
Raw Normal View History

import type { CommandDef } from "../../web/hooks/command.ts";
import { syscall } from "./syscall.ts";
2022-04-01 23:07:08 +08:00
export function invokeFunction(
2022-04-05 23:02:17 +08:00
env: string,
2022-04-01 23:07:08 +08:00
name: string,
...args: any[]
): Promise<any> {
return syscall("system.invokeFunction", env, name, ...args);
2022-04-01 23:07:08 +08:00
}
2022-04-27 01:04:36 +08:00
2022-09-06 20:36:06 +08:00
// Only available on the client
export function invokeCommand(name: string): Promise<any> {
2022-07-11 15:08:22 +08:00
return syscall("system.invokeCommand", name);
}
2022-09-06 20:36:06 +08:00
// Only available on the client
export function listCommands(): Promise<{ [key: string]: CommandDef }> {
2022-09-06 20:36:06 +08:00
return syscall("system.listCommands");
}
export function reloadPlugs() {
2022-04-27 02:31:31 +08:00
syscall("system.reloadPlugs");
2022-04-27 01:04:36 +08:00
}