From aef1b22291d36510ec31c755d8565671442be101 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 23 Aug 2021 16:32:25 +0530 Subject: [PATCH] console.error instead of throwing when unregistering handlers --- www/common/common-util.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/common/common-util.js b/www/common/common-util.js index 3d2a8d0a4..fbed064dc 100644 --- a/www/common/common-util.js +++ b/www/common/common-util.js @@ -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 () {