Skip to content

Commit ccb8ba9

Browse files
committed
clearInteractions event
1 parent afd8b5c commit ccb8ba9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/web/js/events.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,11 @@ function makeEvents(config) {
252252
}, `Ran the last interaction, ${interaction}.`, state);
253253
});
254254

255+
async function clearInteractions(state) {
256+
interactionsSinceLastRun = [];
257+
$("#output").empty();
258+
}
259+
255260
async function runInteraction(src, reportAnswer) {
256261
// Because of a bug we introduced, a bunch of rooms ended up with states with null
257262
// interactions. If left null, they will put the editor into an unrecoverable state.
@@ -395,6 +400,9 @@ function makeEvents(config) {
395400
stop();
396401
addMessage({ process: async () => { return runProgram(state); } });
397402
break;
403+
case "clearInteractions":
404+
addMessage({ process: async () => { return clearInteractions(state); } });
405+
break;
398406
case "setContents":
399407
addMessage({ process: async () => { return editorUpdate(message.text); } });
400408
break;

0 commit comments

Comments
 (0)