API reference
The API reference for WRT.
w96.WRT
w96.WRT
Description: Runs a script under WRT and returns the result of the evaluation. The result is a Promise
, since WRT scripts are ran asynchronously by default.
Examples:
const scriptResult = await w96.WRT.run("return await FS.readstr('c:/system/credits.txt')");
// Returns the contents of c:/system/credits.txt
// A simple module include demonstration
// Includes can use relative paths, unlike the standard Windows 96 FS functions.
/* ======= code to eval with WRT ======= */
const code = `const myModule = await include("c:/test.js");
console.log(myModule.something());`;
await w96.WRT.run(code);
/* ======= code for c:/test.js ======= */
module.exports = {
something: ()=>"Hello, world!"
}
// Returns the current working directory, which has been preset in the parameters.
await w96.WRT.run("console.log(current.cwd)", {
cwd: "c:/system"
});
Description: Runs a script file under WRT and returns the result of the evaluation. Like WRT.run
, the result is a Promise
since its ran asynchronously.
Examples:
// Runs a script file located in c:/user
await w96.WRT.runFile("c:/user/test.js");
Last updated
Was this helpful?