Skip to content

Commit

Permalink
files: Fix event listener leak (#1504)
Browse files Browse the repository at this point in the history
This would slowly leak memory and break games that need to detect the
escape button
  • Loading branch information
GarboMuffin authored Jun 2, 2024
1 parent 188a0c0 commit 084034a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extensions/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
_resolve(text);
Scratch.vm.renderer.removeOverlay(outer);
Scratch.vm.runtime.off("PROJECT_STOP_ALL", handleProjectStopped);
document.body.removeEventListener("keydown", handleKeyDown);
document.body.removeEventListener("keydown", handleKeyDown, {
capture: true,
});
};

let isReadingFile = false;
Expand Down

0 comments on commit 084034a

Please sign in to comment.