ui.registerResource
Registers a built static directory for this gamemode lifetime. Changes become a new version after gamemode reload.
Signature
Section titled “Signature”ui.registerResource(options: UiResourceOptions): Promise<UiResource>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
options |
UiResourceOptions |
Name, built directory and exact API origins. |
Returns
Section titled “Returns”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.
Example
Section titled “Example”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"],});