Scenes. SceneContext

new SceneContext()

Members

ctx :OpengramContext

current

leaving :boolean

Type:
  • boolean

options :StageOptions

Type:
  • StageOptions

scenes :Map.<string, (Scenes.WizardScene|Scenes.BaseScene)>

session

Getter returns current scene session object

state

Getter returns state of current scene

state

Setter sets state of current scene

Methods

(async) enter(sceneId, initialStateopt, silentopt) → {Promise}

Enter to scene by name

Use initialState to pass some initial data of ctx.scene.state

Parameters:
NameTypeAttributesDescription
sceneIdstring

Scene name

initialStateobject<optional>

Scene initial state

silentboolean<optional>

If true, enters to given scene without calling enterhandler, and without calling leave handler for current scene (if user currently in scene)

Throws:
Error
Returns:
Type: 
Promise

(async) leave() → {Promise.<void>}

Used to exit the current scene

Returns:
Type: 
Promise.<void>

reenter() → {Promise}

Used for re-entering to current scene without destroying ctx.scene.state

Throws:
Error
Returns:
Type: 
Promise

reset() → {void}

Resets scenes data

Returns:
Type: 
void