const unit = new StringUnit({initialValue: 'a'});
unit.goBack(); // won't work, returns false
unit.goForward(); // won't work, returns false
unit.dispatch('b'); // cache becomes ['a', 'b']
console.log(unit.value()) // logs 'b'
unit.goBack(); // cache is still ['a', 'b']
console.log(unit.value()) // logs 'a'
unit.goForward(); // cache is still ['a', 'b']
console.log(unit.value()) // logs 'b'
unit.jumoToStart(); // cache is still ['a', 'b']
console.log(unit.value()) // logs 'a'
unit.dispatch('d', {replaceCache: true}) // now the cache becomes ['d', 'b']
// 'a' is gone, instead of 'b'
console.log(unit.value()) // logs 'd'
unit.jump(1) // cache is still ['d', 'b']
console.log(unit.value()) // logs 'b'
// we can also access all the cached values
console.log(unit.cachedValues()) // logs ['d', 'b']
// or check the current cache index
console.log(unit.cacheIndex) // logs 0
// or check the count of cached values
console.log(unit.cachedValuesCount) // logs 2