title: Core section: core
sendResp(content)Sets HTTP_RESP.
sendResp("done");
echo(content)Appends text to current HTTP_RESP.
echo("Hello ");
echo("World");
sendOK()Sets response to ok.
sendOK();
sendJSONResp(objectOrJsonString)Sets HTTP_HEADER = application/json and writes JSON response.
sendJSONResp({ success: true, items: [1, 2, 3] });
registerModule(jsonConfigString)Registers a module from JSON config.
registerModule(JSON.stringify({
Name: "MyApp",
Desc: "Example module",
Group: "Utilities",
IconPath: "icon.png",
Version: "1.0",
StartDir: "index.html",
SupportFW: true,
LaunchFWDir: "index.html"
}));
addNightlyTask(scriptPath)Adds a valid AGI script to nightly task list.
addNightlyTask("MyApp/nightly.agi");
includes(scriptName)Loads and executes another script relative to current script directory.
includes("helpers.js");
delay(ms)Sleeps for milliseconds.
delay(500);
exit()Stops script execution.
if (!userIsAdmin()) exit();
execd(scriptName, payload)Executes another script asynchronously.
execd("worker.agi", JSON.stringify({ job: "thumbs" }));
requirepkg(...) -> deprecated in AGI v3execpkg(...) -> deprecated in AGI v3decodeVirtualPath(...) -> deprecateddecodeAbsoluteVirtualPath(...) -> deprecatedencodeRealPath(...) -> deprecated