Merge pull request #1516 from syranide/es5err

Preemptively error when required ES5 shim/shams are not available
This commit is contained in:
Pete Hunt
2014-05-12 13:40:00 -07:00
+28
View File
@@ -88,6 +88,34 @@ if (__DEV__) {
'Download the React DevTools for a better development experience: ' +
'http://fb.me/react-devtools'
);
var expectedFeatures = [
// shims
Array.isArray,
Array.prototype.every,
Array.prototype.forEach,
Array.prototype.indexOf,
Array.prototype.map,
Date.now,
Function.prototype.bind,
Object.keys,
String.prototype.split,
// shams
Object.create,
Object.freeze
];
for (var i in expectedFeatures) {
if (!expectedFeatures[i]) {
console.error(
'One or more ES5 shim/shams expected by React are not available: ' +
'http://facebook.github.io/react/docs/working-with-the-browser.html' +
'#polyfills-needed-to-support-older-browsers'
);
break;
}
}
}
}