The Loader API
is a JavaScript API for asynchronously loading or caching
files. Lua programmers can find similar capabilities in the Async module.
Function | Description |
---|---|
async FetchWSFile(filenm, filetype="text") [1] |
Returns a promise that resolves to a data converted to the requested datatype. Use "binary" for binary files. |
async ResolveWSFile(filenm, verify=true) [1] |
Returns a promise that resolves to a fully-qualifed path under the current defintion of workspace. |
async FetchURL(url, responseType) |
Returns a promise that resolves to an object appropriate to responseType}` |
async FetchToCache(urlbase, relpath, cacheRoot, cacheNS, forceUpdate=false) * |
Fetch and cache the requested internet file into the designated cache area. |
async LoadAppResourceFile(filenm) [2] |
Returns a promise resolving to the contents of filenm. |
*
this method is used by SampleMgr
Function | Description |
---|---|
LoadAndExecuteScript(filenm, ctxId, callback?) * [1][3][4][5] |
Loads filenm into the JS sandbox and peforms it. |
async Require(filenm) [1][5] |
Loads filenm into the JS sandbox, performs it and returns module contents. |
*
this method is used to perform scripts you write
[1] filenm is workspace-relative, eg: "_plugins/anode.yaml"
[2] filenm is Hz-install-relative
[3] optional callback is executed after the script is loaded
[4] ctxId is a system state obtained like so: this.GetId()
[5] require-compatible module must assign its contents to the global object exports