* Get a global variable by name * * @version 0.2.5 * @param name The name of the global variable to fetch * @param persisted Whether the global variable is persisted
(name: K, persisted = true)
| 1130 | return this.executeCodeTriggerWithCustomEventResponse(triggerName, args); |
| 1131 | |
| 1132 | return await this.request<ExecuteCodeTriggerResponse>({ |
| 1133 | request: 'ExecuteCodeTrigger', |
| 1134 | triggerName, |
| 1135 | args, |
| 1136 | }); |
| 1137 | } |
| 1138 | |
| 1139 | /** |
| 1140 | * Executes a code trigger and waits for a matching Custom event response |
| 1141 | * |
| 1142 | * @param triggerName The name of the code trigger to execute |
| 1143 | * @param args Optional arguments to pass to the code trigger |
| 1144 | * @param timeout Maximum time to wait for response in milliseconds |
| 1145 | * @returns Promise resolving to the Custom event data |
| 1146 | */ |
| 1147 | private async executeCodeTriggerWithCustomEventResponse<T = Record<string, any>>( |
| 1148 | triggerName: string, |
| 1149 | args: Record<string, any> = {}, |
| 1150 | timeout: number = 10_000, |
| 1151 | ): Promise<ExecuteCodeTriggerResponse<T>> { |
| 1152 | if (!this.socket || this.socket.readyState !== this.socket.OPEN) { |
| 1153 | throw new Error('WebSocket is not connected'); |