load-source
Version:
A simple function for load js/image/css/style
26 lines (21 loc) • 959 B
TypeScript
import { ImageAttributes } from 'mount-image';
import { LinkAttributes } from 'mount-css';
import { ScriptAttributes } from 'mount-script';
import { StyleAttributes } from 'mount-style';
/**
* Dynamic loading of resources, support js, images, css links, css style strings
*
* @param url - link to the resource, type must be passed when passing in styleString
* @param option - parameters: attrs, props, force
* @returns - true|false|imgUrl
*/
declare function loadSource(url: string, option: SourceFileType | SourceOptions): Promise<boolean | string>;
export default loadSource;
export declare type SourceFileType = 'js' | 'img' | 'css' | 'style' | string;
export declare interface SourceOptions {
type: SourceFileType;
attrs?: LinkAttributes | StyleAttributes | ScriptAttributes | ImageAttributes;
props?: LinkAttributes | StyleAttributes | ScriptAttributes | ImageAttributes;
force?: boolean;
}
export { }