(stringifiedConfig: string)
| 73 | } |
| 74 | |
| 75 | function push(stringifiedConfig: string) { |
| 76 | const config = JSON.parse(stringifiedConfig); |
| 77 | const sources = extractEditorSources(config.content); |
| 78 | if (sources.length > 0) { |
| 79 | const completeHistory = list(); |
| 80 | const duplicateIdx = getSimilarSourcesIndex(completeHistory, getArrayWithJustTheCode(sources)); |
| 81 | |
| 82 | if (duplicateIdx === -1) { |
| 83 | while (completeHistory.length >= maxHistoryEntries) { |
| 84 | completeHistory.shift(); |
| 85 | } |
| 86 | |
| 87 | completeHistory.push({ |
| 88 | dt: Date.now(), |
| 89 | sources: sources, |
| 90 | config: config, |
| 91 | }); |
| 92 | } else { |
| 93 | completeHistory[duplicateIdx].dt = Date.now(); |
| 94 | } |
| 95 | |
| 96 | localStorage.set('history', JSON.stringify(completeHistory)); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | export function trackHistory(layout: any) { |
| 101 | let lastState: string | null = null; |
nothing calls this directly
no test coverage detected