1
0
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 15:07:08 +00:00
export function invokeFunction(
2022-04-05 15:02:17 +00:00
env: string,
2022-04-01 15:07:08 +00:00
name: string,
...args: any[]
): Promise<any> {
return syscall("system.invokeFunction", env, name, ...args);
2022-04-01 15:07:08 +00:00
}
2022-04-26 17:04:36 +00:00
2022-09-06 12:36:06 +00:00
// Only available on the client
export function invokeCommand(name: string): Promise<any> {
2022-07-11 07:08:22 +00:00
return syscall("system.invokeCommand", name);
}
2022-09-06 12:36:06 +00:00
// Only available on the client
export function listCommands(): Promise<{ [key: string]: CommandDef }> {
2022-09-06 12:36:06 +00:00
return syscall("system.listCommands");
}
export function reloadPlugs() {
2022-04-26 18:31:31 +00:00
syscall("system.reloadPlugs");
2022-04-26 17:04:36 +00:00
}