@j2inn/app
Version:
J2 Innovations core application framework
60 lines (59 loc) • 2.13 kB
TypeScript
import { HDict } from 'haystack-core';
import { ResourceElement } from './ResourceElement';
/**
* Declare the global webpack functions/properties.
*/
declare global {
function __webpack_init_sharing__(module: string): Promise<void>;
const __webpack_share_scopes__: {
default: string;
};
}
/**
* Loads the default exported module from some JS with the defined scope and module.
*
* @param scope The scope of the module to load.
* @param module The name of the module to load.
* @returns The loaded component.
*/
export declare function loadDefault<DefaultType>(scope: string, module: string): () => Promise<{
default: DefaultType;
}>;
/**
* Asynchronously load the dynamic resource at runtime and wait for it to load.
*
* @param url The URL to load.
* @returns A promise that's resolved once the resource has loaded.
*/
export declare function loadDynamicResource(url: string, type?: ScriptTagType): Promise<ResourceElement>;
export declare function loadDynamicResources(urls: string[], type?: ScriptTagType): Promise<ResourceElement[]>;
/**
* Returns the pod name.
*
* @param def The def dict.
* @returns The name of the pod the resource was loaded from.
*/
export declare function getPodName(def: HDict): string;
/**
* Returns the remote entry point for an app.
*
* @param app The FIN app to get the remote entry point from.
* @param ui The FIN app view to load the remote entry point from.
* @param path The remote path to load. Defaults to `remoteEntry.js`.
* @returns The remote entry point.
*/
export declare function getRemoteEntry(app: HDict, ui?: HDict, path?: string): string;
/**
* Returns properties with values that can be rendered nicely as strings.
* All objects and functions are excluded. All keys are made lowercase.
*
* @param props The properties to convert.
* @returns The properties as strings.
*/
export declare function toStringProps(props: Record<string, unknown>): Record<string, string>;
export declare enum ScriptTagType {
module = "module",
importmap = "importmap",
javascript = "text/javascript",
json = "application/json"
}