mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #1516 from syranide/es5err
Preemptively error when required ES5 shim/shams are not available
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user