Browse Source

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

j8
Lyubo Marinov 8 years ago
parent
commit
bd51613e62
2 changed files with 14 additions and 0 deletions
  1. 1
    0
      package.json
  2. 13
    0
      react/features/base/lib-jitsi-meet/native/polyfills-browser.js

+ 1
- 0
package.json View File

@@ -20,6 +20,7 @@
20 20
     "async": "0.9.0",
21 21
     "autosize": "^1.18.13",
22 22
     "bootstrap": "3.1.1",
23
+    "es6-iterator": "2.0.0",
23 24
     "i18next": "7.0.0",
24 25
     "i18next-browser-languagedetector": "1.0.1",
25 26
     "i18next-xhr-backend": "1.3.0",

+ 13
- 0
react/features/base/lib-jitsi-meet/native/polyfills-browser.js View File

@@ -1,3 +1,4 @@
1
+import Iterator from 'es6-iterator';
1 2
 import BackgroundTimer from 'react-native-background-timer';
2 3
 import 'url-polyfill'; // Polyfill for URL constructor
3 4
 
@@ -98,6 +99,18 @@ function _visitNode(node, callback) {
98 99
         global.addEventListener = () => {};
99 100
     }
100 101
 
102
+    // Array.prototype[@@iterator]
103
+    //
104
+    // Required by:
105
+    // - for...of statement use(s) in lib-jitsi-meet
106
+    const arrayPrototype = Array.prototype;
107
+
108
+    if (typeof arrayPrototype['@@iterator'] === 'undefined') {
109
+        arrayPrototype['@@iterator'] = function() {
110
+            return new Iterator(this);
111
+        };
112
+    }
113
+
101 114
     // document
102 115
     //
103 116
     // Required by:

Loading…
Cancel
Save