From bd51613e62e3283155fbdedc0b4240a066301691 Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Wed, 1 Mar 2017 21:30:21 -0600 Subject: [PATCH] [RN] Support the for...of statement in lib-jitsi-meet --- package.json | 1 + .../base/lib-jitsi-meet/native/polyfills-browser.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/package.json b/package.json index 2bf61ba1b..37c09fece 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "async": "0.9.0", "autosize": "^1.18.13", "bootstrap": "3.1.1", + "es6-iterator": "2.0.0", "i18next": "7.0.0", "i18next-browser-languagedetector": "1.0.1", "i18next-xhr-backend": "1.3.0", diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js index 903b82928..a2a80d567 100644 --- a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js +++ b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js @@ -1,3 +1,4 @@ +import Iterator from 'es6-iterator'; import BackgroundTimer from 'react-native-background-timer'; import 'url-polyfill'; // Polyfill for URL constructor @@ -98,6 +99,18 @@ function _visitNode(node, callback) { global.addEventListener = () => {}; } + // Array.prototype[@@iterator] + // + // Required by: + // - for...of statement use(s) in lib-jitsi-meet + const arrayPrototype = Array.prototype; + + if (typeof arrayPrototype['@@iterator'] === 'undefined') { + arrayPrototype['@@iterator'] = function() { + return new Iterator(this); + }; + } + // document // // Required by: