Fix pull request

This commit is contained in:
fkloft 2015-10-10 23:56:46 +02:00
parent a90d71335c
commit d367cff8c5

View File

@ -110,6 +110,10 @@ window.removeHook = function(event, callback) {
if (typeof callback !== 'function') throw('Callback must be a function.');
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);
}
}