UNPKG

@kwiz/common

Version:

KWIZ common utilities and helpers for M365 platform

35 lines (34 loc) 1.79 kB
import { IKnownScript, ksGlobal } from "../types/knownscript.types"; import { iSodCallbacks } from "./sod"; export interface IScriptUtils { /** @deprecated - use wrapFunction instead from helpers/functions */ wrapFunction3?: (originalFunction: () => void, instance: any, doBefore: () => void, doAfter: () => void) => void; loadKnownScript: (script: IKnownScript) => void; loadKnownScript_Sync: (script: IKnownScript) => void; ensureScript: (scriptUrl: string, global: ksGlobal, callback: (() => void) | iSodCallbacks, sodName: string) => void; ensureScripts: (scripts: { scriptUrl: string; global: ksGlobal; sodName: string; }[], callback: (() => void) | iSodCallbacks) => void; } export default class script implements IScriptUtils { private static instance; isRtl: boolean; static get Instance(): script; loadKnownScript(knownScript: IKnownScript): Promise<unknown>; loadKnownScript_Sync(knownScript: IKnownScript): any; private ensureKnownScriptInternal; loadCss(cssUrl: string): void; ensureScriptSync(scriptUrl: string, global: ksGlobal, callbacks?: iSodCallbacks, sodName?: string): void; ensureScript(scriptUrl: string, global: ksGlobal, callbacks?: (() => void) | iSodCallbacks, sodName?: string): Promise<void>; /** ensure a collection of scripts and call the callback when they are all done */ ensureScripts(scripts: { scriptUrl: string; global: ksGlobal; sodName: string; }[], callbacks?: (() => void) | iSodCallbacks): Promise<void[]>; private _WrapFunctionArr; /** @deprecated - use wrapFunction instead from helpers/functions */ wrapFunction3(originalFunction: () => void, instance: any, doBefore: () => void, doAfter: () => void): void; }