@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
30 lines (29 loc) • 897 B
TypeScript
interface IScript {
load(): Promise<any>;
remove(): HTMLScriptElement;
}
/**
* Creates a script element from a certain source in the passed node selector.
* If no selector is passed it will add the script element in the body.
*
* @example
* ```
* const script = new Script('https://example.com/script.js', '.container');
* script.load().then(doSomething);
*
* // To clean up just call the remove method
* script.remove();
* ```
*/
declare class Script implements IScript {
private readonly src;
private readonly node;
private readonly attributes;
private readonly dataAttributes;
private isScriptLoadCalled;
private script;
constructor(src: any, node?: string, attributes?: Partial<HTMLScriptElement>, dataAttributes?: Record<string, string | undefined>);
load: () => Promise<void>;
remove: () => HTMLScriptElement;
}
export default Script;