Skip to content

ScriptedDialogDriver

A FIFO driver that answers each dialog with the next step of its script.

It checks the request’s kind, and its interaction id when the step names one, records every request in ScriptedDialogDriver.transcript, and ScriptedDialogDriver.assertDone fails when a step was never used.

Import:

import { ScriptedDialogDriver } from '@mnaoumov/obsidian-lib/modals/scripted-dialog-driver';

Signature:

export class ScriptedDialogDriver implements DialogDriver

Implements: DialogDriver

Constructor

new ScriptedDialogDriver(steps: readonly (((ScriptedDialogPassthroughStep | ScriptedDialogAlertStep | ScriptedDialogValueProviderStep<"alert">) & ScriptedDialogStepBase<"alert">) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<"confirm"> | ScriptedDialogValueProviderStep<"confirm">) & ScriptedDialogStepBase<"confirm">) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<"prompt"> | ScriptedDialogValueProviderStep<"prompt">) & ScriptedDialogStepBase<"prompt">) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<"selectItem"> | ScriptedDialogValueProviderStep<"selectItem">) & ScriptedDialogStepBase<"selectItem">) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<"selectOption"> | ScriptedDialogValueProviderStep<"selectOption">) & ScriptedDialogStepBase<"selectOption">))[], options?: ScriptedDialogDriverConstructorOptions)

Creates a scripted driver.

Properties

PropertyTypeDescription
handle(request: DialogRequest) => Promisable<DialogDriverResponse>Handles one dialog request, or passes it through to the real modal.
(Inherited from DialogDriver)

Methods

MethodReturnsDescription
assertDone()voidThrows when a scripted step was never used.
handle(request)Promise<DialogDriverResponse>Records a request, checks it against the next step, and answers it.

Links to this page: