diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index ebedd5c6..41a197dd 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -212,19 +212,16 @@ requires return { bind: function(id, event, callback) { if (isKeyboardEvent(event)) { - keyboardEvents[id] = keyboardEvents[id] || []; - keyboardEvents[id].push({ - event: event, - callback: callback - }); + keyboardEvents[id] = keyboardEvents[id] || {}; + keyboardEvents[id][event] = callback; } if (!isKeyboardEvent(event) || Ox.Focus.focused() == id) { $eventHandler.bind(event, callback); } }, bindKeyboard: function(id) { - $.each(keyboardEvents[id] || [], function(i, event) { - Ox.Event.bind(id, event.event, event.callback); + $.each(keyboardEvents[id] || [], function(event, callback) { + Ox.Event.bind(id, event, callback); }); }, trigger: function(event, data) { @@ -233,9 +230,9 @@ requires }, unbind: function(id, event, callback) { if (isKeyboardEvent(event)) { - $.each(keyboardEvents[id] || [], function(i, e) { - if (e.event == event) { - keyboardEvents[id].splice(i, 1); + $.each(keyboardEvents[id] || [], function(e, callback) { + if (e == event) { + delete keyboardEvents[id][e]; return false; } }); @@ -245,8 +242,8 @@ requires unbindKeyboard: function(id) { //Ox.print(keyboardEvents) //Ox.print("unbindKeyboard", id, keyboardEvents[id]) - $.each(keyboardEvents[id] || [], function(i, e) { - $eventHandler.unbind(e.event, e.callback); + $.each(keyboardEvents[id] || [], function(event, callback) { + $eventHandler.unbind(event, callback); }); } }