/*! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Copyright (C) 2022 jeffy-g Released under the MIT license https://opensource.org/licenses/mit-license.php - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /** * NOTE: `NsLoader` is only available in the umd module. * * ```html * * * ``` */ declare var NsLoader: typeof import("./index"); /** * `cslCallback` is the callback function name called by default to notify the zip file load completion * when `data-csl-config` is embedded in the script element. * * If `cslCallback` is determined not to be a function, an attempt will be made to notify the load completion * using the callback function name set in `TCSLConfig.callback`. */ declare var cslCallback: TCSLCallbak; declare interface Window { cslCallback: TCSLCallbak; [cbname: TCSLCallbackKey]: TCSLCallbak; } type TCSLCallbackKey = string & { __type__: "cslCallback" }; type TCSLCallbak = ((err?: Error[]) => void) | undefined; /** * (C)ompressed-(S)cript-(L)oader config * * @date 2022/5/14 * @version 1.3 */ type TCSLConfig = { /** * Specifies the directory that contains the zip file * * ```js * base: "./lib" // or https://example.com/lib * ``` */ base: string; /** * #### Insertion selector * * + can be omit. In the current specification, specify element inside `head` * element to insert into` head` element. * * + If omitted, it will be inserted after `document.head.lastElementChild` * * NOTE: This will change in the near future * * ```js * selector: "script[src*=css-2d-renderer]" * ``` */ selector?: string; /** * list of zip files you want to load * * + The comment attached to the zip file entry is used for `script.integrity` * * NOTE: Omit the `.zip` extension * * ```js * // actually, "system-coordinate-map-mini.zip", "bundle.zip" * load: ["system-coordinate-map-mini", "bundle"] * ``` */ load: string | string[]; /** * can be omit, default: "cslCallback" * * Please specify if you need to use another name * * ```js * var cslCallback = () => { * runEVEWorld(() => { * window.setTimeout(() => { * document.querySelectorAll("script[src^='./loader/'],script[src*='compressed-script-loader']").forEach(script => script.remove()); * delete window.NsLoader; * }, 1000); * }); * }; * ``` */ callback?: TCSLCallbackKey; /** * if need auto cleanup * * @default undefined * @since 1.2.12 */ cleanup?: true; }; /** * @internal */ type TSRI = `sha${256 | 384 | 512}-${string}`;