react/perf/tests/renderComponent-basic.js

23 lines
563 B
JavaScript
Raw Normal View History

2015-02-13 04:48:11 +08:00
if (typeof exports === 'undefined') {
exports = {};
}
2013-12-17 13:25:05 +08:00
/*http://benchmarkjs.com/docs#options*/
exports.name = 'React.render single div';
2013-12-17 13:25:05 +08:00
2015-02-13 04:48:11 +08:00
exports.setup = function() {
_rootNode = document.createElement('div');
2013-12-17 13:25:05 +08:00
document.body.appendChild(_rootNode);
};
2015-02-13 04:48:11 +08:00
exports.fn = function() {
React.render(React.DOM.div(null, 'lol, perf testing ', this.count), _rootNode);
2013-12-17 13:25:05 +08:00
};
2015-02-13 04:48:11 +08:00
exports.teardown = function() {
if (React.unmountAndReleaseReactRootNode) {
React.unmountAndReleaseReactRootNode(_rootNode);
} else {
React.unmountComponentAtNode(_rootNode);
}
2013-12-17 13:25:05 +08:00
};