Skip to content

Commit e96bf36

Browse files
author
Philip Guo
committed
fixed keydown handlers being bound multiple times
1 parent b97ee70 commit e96bf36

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎v3/js/iframe-embed.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ $(document).ready(function() {
146146
});
147147

148148
// set keyboard bindings
149+
// VERY IMPORTANT to clear and reset this every time or
150+
// else the handlers might be bound multiple times
151+
$(document).unbind('keydown');
149152
$(document).keydown(function(k) {
150153
if (k.keyCode == 37) { // left arrow
151154
if (myVisualizer.stepBack()) {

‎v3/js/opt-frontend.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ $(document).ready(function() {
227227

228228

229229
// set keyboard bindings
230+
// VERY IMPORTANT to clear and reset this every time or
231+
// else the handlers might be bound multiple times
232+
$(document).unbind('keydown');
230233
$(document).keydown(function(k) {
231234
if (k.keyCode == 37) { // left arrow
232235
if (myVisualizer.stepBack()) {

0 commit comments

Comments
 (0)