Fix pull request
This commit is contained in:
parent
a90d71335c
commit
d367cff8c5
@ -110,6 +110,10 @@ window.removeHook = function(event, callback) {
|
|||||||
if (typeof callback !== 'function') throw('Callback must be a function.');
|
if (typeof callback !== 'function') throw('Callback must be a function.');
|
||||||
|
|
||||||
if (_hooks[event]) {
|
if (_hooks[event]) {
|
||||||
_hooks[event].splice(_hooks[event].indexOf(callback), 1);
|
var index = _hooks[event].indexOf(callback);
|
||||||
|
if(index == -1)
|
||||||
|
console.warn('Callback wasn\'t registered for this event.');
|
||||||
|
else
|
||||||
|
_hooks[event].splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user