From 6b800d94e3167661278baf4db983a899f9cbb35d Mon Sep 17 00:00:00 2001 From: Jiiks Date: Wed, 31 Jan 2018 15:46:57 +0200 Subject: [PATCH] For is faster --- client/src/ui/dom.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/ui/dom.js b/client/src/ui/dom.js index 330ca962..38f9ec05 100644 --- a/client/src/ui/dom.js +++ b/client/src/ui/dom.js @@ -40,12 +40,15 @@ class DOMObserver { } observerCallback(mutations) { - this.subscriptions.forEach(sub => { + for (let sub of this.subscriptions) { try { const f = mutations.find(sub.filter); - if (f) sub.callback(f); - } catch (err) { } - }); + if (f) { + sub.callback(f); + continue; + } + } catch(err) {} + } } observe() {