fix for firefox memory leak
This commit is contained in:
parent
fa6948dcf2
commit
4d24f9baa3
1 changed files with 9 additions and 12 deletions
|
@ -212,19 +212,16 @@ requires
|
||||||
return {
|
return {
|
||||||
bind: function(id, event, callback) {
|
bind: function(id, event, callback) {
|
||||||
if (isKeyboardEvent(event)) {
|
if (isKeyboardEvent(event)) {
|
||||||
keyboardEvents[id] = keyboardEvents[id] || [];
|
keyboardEvents[id] = keyboardEvents[id] || {};
|
||||||
keyboardEvents[id].push({
|
keyboardEvents[id][event] = callback;
|
||||||
event: event,
|
|
||||||
callback: callback
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (!isKeyboardEvent(event) || Ox.Focus.focused() == id) {
|
if (!isKeyboardEvent(event) || Ox.Focus.focused() == id) {
|
||||||
$eventHandler.bind(event, callback);
|
$eventHandler.bind(event, callback);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
bindKeyboard: function(id) {
|
bindKeyboard: function(id) {
|
||||||
$.each(keyboardEvents[id] || [], function(i, event) {
|
$.each(keyboardEvents[id] || [], function(event, callback) {
|
||||||
Ox.Event.bind(id, event.event, event.callback);
|
Ox.Event.bind(id, event, callback);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
trigger: function(event, data) {
|
trigger: function(event, data) {
|
||||||
|
@ -233,9 +230,9 @@ requires
|
||||||
},
|
},
|
||||||
unbind: function(id, event, callback) {
|
unbind: function(id, event, callback) {
|
||||||
if (isKeyboardEvent(event)) {
|
if (isKeyboardEvent(event)) {
|
||||||
$.each(keyboardEvents[id] || [], function(i, e) {
|
$.each(keyboardEvents[id] || [], function(e, callback) {
|
||||||
if (e.event == event) {
|
if (e == event) {
|
||||||
keyboardEvents[id].splice(i, 1);
|
delete keyboardEvents[id][e];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -245,8 +242,8 @@ requires
|
||||||
unbindKeyboard: function(id) {
|
unbindKeyboard: function(id) {
|
||||||
//Ox.print(keyboardEvents)
|
//Ox.print(keyboardEvents)
|
||||||
//Ox.print("unbindKeyboard", id, keyboardEvents[id])
|
//Ox.print("unbindKeyboard", id, keyboardEvents[id])
|
||||||
$.each(keyboardEvents[id] || [], function(i, e) {
|
$.each(keyboardEvents[id] || [], function(event, callback) {
|
||||||
$eventHandler.unbind(e.event, e.callback);
|
$eventHandler.unbind(event, callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue