@samitouri / QOS-React-2 / commits / 659b7981e1

Preemptively error when required ES5 shim/shams are not available

Andreas Svensson committed May 11, 2014 at 20:46 UTC 659b7981e14c7eb36cf2638a95a3a16f080b8cca
1 file changed +28
src/browser/ui/React.js
+28
@@ -88,6 +88,34 @@ if (__DEV__) {
88 'Download the React DevTools for a better development experience: ' +
89 'http://fb.me/react-devtools'
90 );
91 +
92 + var expectedFeatures = [
93 + // shims
94 + Array.isArray,
95 + Array.prototype.every,
96 + Array.prototype.forEach,
97 + Array.prototype.indexOf,
98 + Array.prototype.map,
99 + Date.now,
100 + Function.prototype.bind,
101 + Object.keys,
102 + String.prototype.split,
103 +
104 + // shams
105 + Object.create,
106 + Object.freeze
107 + ];
108 +
109 + for (var i in expectedFeatures) {
110 + if (!expectedFeatures[i]) {
111 + console.error(
112 + 'One or more ES5 shim/shams expected by React are not available: ' +
113 + 'http://facebook.github.io/react/docs/working-with-the-browser.html' +
114 + '#polyfills-needed-to-support-older-browsers'
115 + );
116 + break;
117 + }
118 + }
119 }
120 }
121