Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[RN] Support the for...of statement in lib-jitsi-meet

Lyubo Marinovbd51613e62e3
diff --git a/package.json b/package.json
index 2bf61ba1bf..37c09fecea 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 903b82928e..a2a80d567f 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: