UNPKG

@sujalchoudhari/solaris-ui

Version:

A UI framework to create HTML pages with just JavaScript.

48 lines (42 loc) 1.91 kB
import Script from "../components/scripts"; /** * ScriptManager * ----- * Manages all scripts in the project. * @remarks * Auto importes all the Scripts in each file. * @author Ansh Sharma */ export default class ScriptManager { static scripts: Script[]; /** A static method in the ScriptManager class that adds a new script to the scripts array. @param {Script} script - An object representing a script to be added. @param {string} script.url - The URL of the script. @param {string} script.script - The script code. This method logs an information message with the added script's URL or script code, and pushes the script object into the scripts array. */ static addscript(script: Script): void; /** A static method in the `ScriptManager` class that removes a script from the scripts array. @param {Script} script - An object representing the script to be removed. This method removes the specified script object from the scripts array. */ static removescript(script: Script): void; /** A static method in the ScriptManager class that checks if a script has already been added to the scripts array. @param {Script} script - An object representing the script to check. @returns {boolean} - true if the script has already been added, false otherwise. */ static isScriptAdded(script: Script): boolean; /** A static method in the ScriptManager class that returns a string containing the JavaScript code of all scripts that have been added to the scripts array and have a type of "inline". @returns {string} - The JavaScript code of all inline scripts. */ static toString(): string; /** A static method in the ScriptManager class that returns an array containing all scripts that have been added to the scripts array and have a type of "external". @returns {Array<Script>} - An array of all external scripts. */ static getExternalScripts(): Array<Script>; }