Skip to content

Commit

Permalink
Preemptively error when required ES5 shim/shams are not available
Browse files Browse the repository at this point in the history
  • Loading branch information
syranide committed May 11, 2014
1 parent 32b84a4 commit 659b798
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/browser/ui/React.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}

Expand Down

0 comments on commit 659b798

Please sign in to comment.