anote
1export default class MessageStore {2private static localStorage: string[] = [];3
4static setValue(val:string) {5this.localStorage.push(val);6if(this.localStorage.length > 5){7this.localStorage.shift();8}9}10
11static getValues(): string[] {12return this.localStorage;13}14
15static getPreviousValue(index: number = 0): string {16return this.getValues()[this.localStorage.length - 2 - index];17}18
19static getValue(id: number): string {20if(id >= this.localStorage.length || id < 0) return 'Value id out of range';21return this.localStorage[id];22}23}