[RN] Third-party ES6 Symbol ponyfill

This commit is contained in:
Lyubo Marinov 2017-03-01 21:31:43 -06:00
parent bd51613e62
commit acd83ede2f
2 changed files with 6 additions and 24 deletions

View File

@ -21,6 +21,7 @@
"autosize": "^1.18.13",
"bootstrap": "3.1.1",
"es6-iterator": "2.0.0",
"es6-symbol": "3.1.0",
"i18next": "7.0.0",
"i18next-browser-languagedetector": "1.0.1",
"i18next-xhr-backend": "1.3.0",

View File

@ -1,24 +1,5 @@
// FIXME React Native does not polyfill Symbol at versions 0.39.2 or earlier.
export default (global => {
let clazz = global.Symbol;
if (typeof clazz === 'undefined') {
// XXX At the time of this writing we use Symbol only as a way to
// prevent collisions in Redux action types. Consequently, the Symbol
// implementation provided bellow is minimal and specific to our
// purpose.
const toString = function() {
return this.join(''); // eslint-disable-line no-invalid-this
};
clazz = description => {
const thiz = (description || '').split('');
thiz.toString = toString;
return thiz;
};
}
return clazz;
})(global || window || this); // eslint-disable-line no-invalid-this
// XXX React Native 0.41.2 does not polyfill Symbol. The React source code of
// jitsi/jitsi-meet does utilize Symbol though. However, it is satisfied with a
// ponyfill.
import Symbol from 'es6-symbol';
export { Symbol as default };