Skip to content

Commit

Permalink
do not save everything in command history of em/wasm demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Apr 22, 2024
1 parent 1e606f2 commit bd9fe87
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion share/emscripten/gpac.html
Expand Up @@ -664,7 +664,7 @@ <h4>Performances</h4>
s = FS.analyzePath('/idbfs/.gpac/history.txt', true);
if (s.error) return;
let strs = FS.readFile('/idbfs/.gpac/history.txt', { encoding: "utf8"}).split('\n');
strs.forEach(s => { if (s.length) cmd_history.push(s); });
strs.forEach(s => { if (s.length && (cmd_history.indexOf(s)<0)) cmd_history.push(s); });
}
//save command history to /idbfs/.gpac/history.txt
function save_history() {
Expand Down Expand Up @@ -791,6 +791,10 @@ <h4>Performances</h4>
}

//save history
let cmd_idx = cmd_history.indexOf(cmd);
if (cmd_idx>=0) {
cmd_history.splice(cmd_idx, 1);
}
cmd_history.push(cmd);
save_history();
cmd_idx = -1;
Expand Down Expand Up @@ -1218,6 +1222,10 @@ <h4>Performances</h4>
}
return;
}
if (args[0]=='clear') {
if (outputElement) outputElement.innerText = '';
return;
}


if (args[0]=='p') {
Expand Down

0 comments on commit bd9fe87

Please sign in to comment.