From 807e581ec748d44cc24ead5d6cfccc69277fc849 Mon Sep 17 00:00:00 2001 From: Chris Bianca Date: Fri, 27 Oct 2017 11:54:36 +0100 Subject: [PATCH] [auth][android][js] Stop removing all listeners when using phone auth --- lib/modules/auth/PhoneAuthListener.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/modules/auth/PhoneAuthListener.js b/lib/modules/auth/PhoneAuthListener.js index 942780be..620ad7f1 100644 --- a/lib/modules/auth/PhoneAuthListener.js +++ b/lib/modules/auth/PhoneAuthListener.js @@ -141,18 +141,14 @@ export default class PhoneAuthListener { _removeAllListeners() { setTimeout(() => { // move to next event loop - not sure if needed // internal listeners - const events = Object.values(this._internalEvents); - - for (let i = 0, len = events.length; i < len; i++) { - this._auth.removeAllListeners(events[i]); - } + Object.values(this._internalEvents).forEach((event) => { + this._auth.removeAllListeners(event); + }); // user observer listeners - const publicEvents = Object.values(this._publicEvents); - - for (let i = 0, len = events.length; i < len; i++) { - this._auth.removeAllListeners(publicEvents[i]); - } + Object.values(this._publicEvents).forEach((publicEvent) => { + this._auth.removeAllListeners(publicEvent); + }); }, 0); }