console.error instead of throwing when unregistering handlers

This commit is contained in:
ansuz 2021-08-23 16:32:25 +05:30
parent d574bc4c81
commit aef1b22291
1 changed files with 3 additions and 1 deletions

View File

@ -75,7 +75,9 @@
handlers.push(cb);
},
unreg: function (cb) {
if (handlers.indexOf(cb) === -1) { throw new Error("Not registered"); }
if (handlers.indexOf(cb) === -1) {
return void console.error("event handler was already unregistered");
}
handlers.splice(handlers.indexOf(cb), 1);
},
fire: function () {