Importing JS
You can import JavaScript files using the engine.importJs
function.
let lib = await engine.importJs('lib.js');return lib.getGreeting();
With a file named lib.js
in the root of the vault.
export function getGreeting() { return 'Hello!';}
Hello!