Skip to content

ui.registerResource

Registers a built static directory for this gamemode lifetime. Changes become a new version after gamemode reload.

ui.registerResource(options: UiResourceOptions): Promise<UiResource>
Name Type Description
options UiResourceOptions Name, built directory and exact API origins.

A promise of an immutable UiResource. Invalid paths, duplicate names, links, changed files and size limits reject registration. Registration starts no download. See HTML UI for bounds and permissions.

gamemodes/my-mode.ts
import { ui } from "nativemp";
import { fileURLToPath } from "node:url";
const menu = await ui.registerResource({
name: "menu", directory: fileURLToPath(new URL("./menu/dist", import.meta.url)),
apiOrigins: ["https://api.example.com"],
});