load-remote
Version:
在 web 项目中引用载入远程资源(css, js),基于<link>/<script>标签实现。Used to load remote resources(CSS/JS) in a web project , based on the html tag(<link>/<script>).
38 lines (34 loc) • 605 B
TypeScript
/**
* @param node
* @param parentNode Default: document.head
* */
declare function injectToHtml(
node:
| Element
| {
id: string
gnt(): Element
},
parentNode?: Element,
): void
interface LoadRemoteOptions {
id?: string
tagName?: 'link' | 'script'
type?: string
rel?: string
charset?: string
/**
* Default: document.head
* */
injectParentElement?: Element
}
declare function loadRemote(
url: string,
options?: LoadRemoteOptions,
): Promise<
| {
target: Element
}
| Event
>
export { LoadRemoteOptions, injectToHtml, loadRemote }