Skip to content
Snippets Groups Projects
commands.ts 1.05 KiB
Newer Older
Michal Malý's avatar
Michal Malý committed
export namespace Commands {
Michal Malý's avatar
Michal Malý committed
    export type Type = 'redraw'|'select-step'|'switch-model';

    export type Redraw = { type: 'redraw' }
    export function Redraw(): Redraw { return { type: 'redraw' }; }
Michal Malý's avatar
Michal Malý committed

    export type SelectStep = {
        type: 'select-step';
        stepName: string;
        prevStepName: string|null;
        nextStepName: string|null;
Michal Malý's avatar
Michal Malý committed
        referenceNtC: string;
        references: ('sel'|'prev'|'next')[];
    }
    export function SelectStep(stepName: string, prevStepName: string|null, nextStepName: string|null, referenceNtC = '', references = ['sel', 'prev', 'next']): SelectStep {
Michal Malý's avatar
Michal Malý committed
        return {
            type: 'select-step',
            stepName,
            prevStepName,
            nextStepName,
Michal Malý's avatar
Michal Malý committed
            referenceNtC,
            references: references as ('sel'|'prev'|'next')[],
        };
    }

    export type SwitchModel = { type: 'switch-model', model: number };
    export function SwitchModel(model: number): SwitchModel { return { type: 'switch-model', model }; }

Michal Malý's avatar
Michal Malý committed
    export type Cmd = Redraw|SelectStep|SwitchModel;