Adding JS Types (#1749)

Added types for some exceptions, config objects, and sleep()
This commit is contained in:
Jeff Glass
2023-09-22 12:19:22 -05:00
committed by GitHub
parent 5079dd19cb
commit c9e7fe16e4
8 changed files with 106 additions and 10 deletions

View File

@@ -46,7 +46,15 @@ const syntaxError = (type, url, { message }) => {
};
// find the shared config for all py-script elements
let config, plugins, parsed, error, type;
let config, type;
/** @type {Promise<any> | undefined} A Promise wrapping any plugins which should be loaded. */
let plugins;
/** @type {any} The PyScript configuration parsed from the JSON or TOML object*. May be any of the return types of JSON.parse() or toml-j0.4's parse() ( {number | string | boolean | null | object | Array} ) */
let parsed;
/** @type {SyntaxError | undefined} The error thrown when parsing the PyScript config, if any.*/
let error;
let pyConfig = $("py-config");
if (pyConfig) {
config = pyConfig.getAttribute("src") || pyConfig.textContent;