diff options
Diffstat (limited to 'node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js')
-rw-r--r-- | node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js b/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js deleted file mode 100644 index 5e149f06e..000000000 --- a/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - -'use strict'; - -var _assign = require('object-assign'); - -var ReactUpdates = require('./ReactUpdates'); -var Transaction = require('./Transaction'); - -var emptyFunction = require('fbjs/lib/emptyFunction'); - -var RESET_BATCHED_UPDATES = { - initialize: emptyFunction, - close: function () { - ReactDefaultBatchingStrategy.isBatchingUpdates = false; - } -}; - -var FLUSH_BATCHED_UPDATES = { - initialize: emptyFunction, - close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) -}; - -var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; - -function ReactDefaultBatchingStrategyTransaction() { - this.reinitializeTransaction(); -} - -_assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, { - getTransactionWrappers: function () { - return TRANSACTION_WRAPPERS; - } -}); - -var transaction = new ReactDefaultBatchingStrategyTransaction(); - -var ReactDefaultBatchingStrategy = { - isBatchingUpdates: false, - - /** - * Call the provided function in a context within which calls to `setState` - * and friends are batched such that components aren't updated unnecessarily. - */ - batchedUpdates: function (callback, a, b, c, d, e) { - var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; - - ReactDefaultBatchingStrategy.isBatchingUpdates = true; - - // The code is written this way to avoid extra allocations - if (alreadyBatchingUpdates) { - return callback(a, b, c, d, e); - } else { - return transaction.perform(callback, null, a, b, c, d, e); - } - } -}; - -module.exports = ReactDefaultBatchingStrategy;
\ No newline at end of file |