ahooks-v2
Version:
react hooks library
16 lines (15 loc) • 547 B
TypeScript
import { BasicTarget } from '../utils/dom';
export interface Options {
type?: 'js' | 'css' | 'img';
media?: HTMLLinkElement['media'];
async?: boolean;
target?: BasicTarget;
}
export declare type Status = 'unset' | 'loading' | 'ready' | 'error';
export declare type Action = {
toggle: () => void;
load: () => void;
unload: () => void;
};
export declare type ExternalElement = HTMLScriptElement | HTMLLinkElement | HTMLImageElement;
export default function useExternal(path: string, options?: Options): [Status, Action];