UNPKG

@puregram/scenes

Version:

Simple implementation of middleware-based scene management for puregram

25 lines (24 loc) 1.02 kB
import { StepContextOptions, StepContextGoOptions } from './step.types'; import { StepSceneHandler } from '../scenes'; export declare class StepSceneContext<S extends Record<string, unknown> = Record<string, any>> { private readonly context; private readonly steps; private stepChanged; constructor(options: StepContextOptions<S>); /** The first enter to the handler */ get firstTime(): any; /** Returns current `stepId` */ get stepId(): number; /** Sets current `stepId` */ set stepId(stepId: number); /** Returns current handler */ get current(): StepSceneHandler<{}, S> | undefined; /** Reenter current step handler */ reenter(): Promise<void>; /** The `go` method goes to a specific step */ go(stepId: number, { silent }?: StepContextGoOptions): Promise<void>; /** Move to the next handler */ next(options?: StepContextGoOptions): Promise<void>; /** Move to the previous handler */ previous(options?: StepContextGoOptions): Promise<void>; }