Options
All
  • Public
  • Public/Protected
  • All
Menu

Class History<T>

Editing history manager. Consists of two stacks: undo and redo history. New states clear redo history, are added to undo history. It's possible for current state to be undefined, in which case the app should load some default state.

Type parameters

  • T

Hierarchy

  • History

Index

Constructors

constructor

  • new History(defaultState: T): History

Properties

currentState

currentState: T

defaultState

defaultState: T

redoHistory

redoHistory: HistoryStack<T>

undoHistory

undoHistory: HistoryStack<T>

Methods

recordStateChange

  • recordStateChange(newState: T): void
  • A new state produced by something other than undo or redo.

    Parameters

    • newState: T

    Returns void

redo

  • redo(): T
  • moves current state into undo, pops redo onto current state

    Returns T

undo

  • undo(): T
  • moves current state into redo, pops undo onto current state

    Returns T

Generated using TypeDoc