import { BiDi } from "../../index"; import { AddPreloadScriptParameters, AddPreloadScriptResult, CallFunctionParameters, DisownParameters, EvaluateParameters, EvaluateResult, GetRealmsParameters, GetRealmsResult, RemovePreloadScriptParameters } from "./types"; import { ScriptEvents } from "./events"; /** * Represents a script instance that interacts with a BiDi connection. */ export default class Script { /** * The BiDi connection object used by this script instance. */ _ws: BiDi; _events: ScriptEvents; /** * Constructs a new instance of the Script. * @param {BiDi} BiDiConnection - The BiDi connection object to use. */ constructor(BiDiConnection: BiDi); /** * Gets Script events. * @returns {ScriptEvents} The Script events. */ get events(): ScriptEvents; /** * Adds a preload script to the BiDi connection. * @param {AddPreloadScriptParameters} context - The parameters for adding a preload script. * @returns {Promise} A promise that resolves with the result of adding a preload script. */ addPreloadScript(context: AddPreloadScriptParameters): Promise; /** * Disowns a script from the BiDi connection. * @param {DisownParameters} context - The parameters for disowning a script. * @returns {Promise} A promise that resolves when the script is disowned. */ disown(context: DisownParameters): Promise; /** * Calls a function on the BiDi connection. * @param {CallFunctionParameters} context - The parameters for calling a function. * @returns {Promise} A promise that resolves with the result of calling a function. */ callFunction(context: CallFunctionParameters): Promise; /** * Evaluates a script on the BiDi connection. * @param {EvaluateParameters} context - The parameters for evaluating a script. * @returns {Promise} A promise that resolves with the result of evaluating a script. */ evaluate(context: EvaluateParameters): Promise; /** * Gets the realms from the BiDi connection. * @param {GetRealmsParameters} context - The parameters for getting realms. * @returns {Promise} A promise that resolves with the result of getting realms. */ getRealms(context: GetRealmsParameters): Promise; /** * Removes a preload script from the BiDi connection. * @param {RemovePreloadScriptParameters} context - The parameters for removing a preload script. * @returns {Promise} A promise that resolves when the preload script is removed. */ removePreloadScript(context: RemovePreloadScriptParameters): Promise; }