Type alias InitminalRun

InitminalRun: {
    run: ((code: string, dependencies?: Record<string, string>, arg?: unknown, callTarget?: string, timeout?: number) => Promise<EvalResult>);
    runMightThrow: ((code: string, dependencies?: Record<string, string>, arg?: unknown, callTarget?: string, timeout?: number) => Promise<unknown>);
    terminate: (() => void);
}

Type declaration

  • run: ((code: string, dependencies?: Record<string, string>, arg?: unknown, callTarget?: string, timeout?: number) => Promise<EvalResult>)
      • (code: string, dependencies?: Record<string, string>, arg?: unknown, callTarget?: string, timeout?: number): Promise<EvalResult>
      • Returns

        output of code execution

        Parameters

        • code: string

          the code to be evaluated

        • Optional dependencies: Record<string, string>
        • Optional arg: unknown

          the argument to be passed to the function if callTarget is a function. Ignored if callTarget is not a function.

        • Optional callTarget: string

          the name of the export to be called (if it is a function) or returned directly (it if is a value). If the export is a Promise (or a function returning a Promise), it will be awaited until the value is resolved and returned. Defaults to initminal.

        • Optional timeout: number

          how long the code is allow to run before it is terminated. Defaults to 3 seconds

        Returns Promise<EvalResult>

  • runMightThrow: ((code: string, dependencies?: Record<string, string>, arg?: unknown, callTarget?: string, timeout?: number) => Promise<unknown>)
      • (code: string, dependencies?: Record<string, string>, arg?: unknown, callTarget?: string, timeout?: number): Promise<unknown>
      • similar to run, but throws an error if the execution fails

        Parameters

        • code: string
        • Optional dependencies: Record<string, string>
        • Optional arg: unknown
        • Optional callTarget: string
        • Optional timeout: number

        Returns Promise<unknown>

  • terminate: (() => void)
      • (): void
      • terminate the underlying worker

        Returns void

Generated using TypeDoc