UNPKG

piral-base

Version:

The base library for creating a Piral instance.

40 lines (39 loc) 1.84 kB
import type { Pilet, PiletApiCreator, PiletApp, PiletMetadata } from '../types'; declare global { interface HTMLScriptElement { app?: PiletApp; } } export declare function createEvaluatedPilet(meta: Omit<PiletMetadata, 'basePath'>, mod: any): Pilet; export declare function checkCreateApi(createApi: PiletApiCreator): boolean; /** * Checks the given pilet app for validity. * @param name The name of the pilet to check against. * @param app The evaluated app to check. * @returns The app to be used for the pilet. */ export declare function checkPiletApp(name: string, app?: any): PiletApp; /** * Checks the given pilet app asynchrously for validity. * @param name The name of the pilet to check against. * @param app The evaluated - or evaluating - app to check. * @returns A promise resolving to the app of the pilet. */ export declare function checkPiletAppAsync(name: string, app?: PiletApp | Promise<PiletApp>): Promise<PiletApp>; /** * Includes a pilet as a script. * @param depName The name of the dependency (require reference). * @param link The link to the script. * @param integrity The integrity for the script, if any. * @param crossOrigin Defines if cross-origin should be used. * @returns The promise resolving to the pilet app. */ export declare function includeScript(depName: string, link: string, integrity?: string, crossOrigin?: string): Promise<import("../types").SinglePiletApp | import("../types").MultiPiletApp>; /** * Includes a dependency as a script. * @param link The link to the script. * @param integrity The integrity for the script, if any. * @param crossOrigin Defines if cross-origin should be used. * @returns The script element. */ export declare function includeScriptDependency(link: string, integrity?: string, crossOrigin?: string): Promise<HTMLScriptElement>;