import { Direction } from "./navigator" ; type Step = { direction : Direction ; node ? : HTMLElement ; } ; class History { private steps : Step [ ] = [ ] ; private limit = 10 ; public add ( step ) { this . steps . push ( step ) ; this . steps = this . steps . slice ( Math . max ( this . steps . length - this . limit , 0 ) , this . steps . length ) ; } public prev ( ) { return this . steps [ this . steps . length - 1 ] ; } public pop ( ) { this . steps . pop ( ) ; } public clean ( ) { this . steps = [ ] ; } } export { History } ;