react/perf/tests/basic-unmount.js

24 lines
677 B
JavaScript
Raw Normal View History

2013-12-17 13:25:05 +08:00
/* jshint undef: true, unused: true */
/* global document */
/* global window */
/* global Benchmark */
/* global React */
if (typeof exports == 'undefined') exports = {};
/*http://benchmarkjs.com/docs#options*/
exports.name = 'unmountComponentAtNode';
exports.setup = function(){
/*global*/_rootNode = document.createElement('div');
document.body.appendChild(_rootNode);
var _firstChild = React.DOM.div(null, 'lol, perf testing ', this.count);
React.renderComponent(_firstChild, _rootNode);
};
exports.fn = function(){
if (React.unmountAndReleaseReactRootNode) React.unmountAndReleaseReactRootNode(_rootNode);
else React.unmountComponentAtNode(_rootNode);
};