MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / push

Function push

static/history.ts:75–98  ·  view source on GitHub ↗
(stringifiedConfig: string)

Source from the content-addressed store, hash-verified

73}
74
75function 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
100export function trackHistory(layout: any) {
101 let lastState: string | null = null;

Callers

nothing calls this directly

Calls 7

extractEditorSourcesFunction · 0.85
listFunction · 0.85
getSimilarSourcesIndexFunction · 0.85
getArrayWithJustTheCodeFunction · 0.85
pushMethod · 0.80
setMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected