UNPKG

1.3 kBJavaScriptView Raw
1/**
2 * Copyright 2014-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
8 *
9 *
10 */
11
12'use strict';
13
14var _prodInvariant = require('./reactProdInvariant');
15
16var invariant = require('fbjs/lib/invariant');
17
18var injected = false;
19
20var ReactComponentEnvironment = {
21 /**
22 * Optionally injectable hook for swapping out mount images in the middle of
23 * the tree.
24 */
25 replaceNodeWithMarkup: null,
26
27 /**
28 * Optionally injectable hook for processing a queue of child updates. Will
29 * later move into MultiChildComponents.
30 */
31 processChildrenUpdates: null,
32
33 injection: {
34 injectEnvironment: function (environment) {
35 !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
36 ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
37 ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
38 injected = true;
39 }
40 }
41};
42
43module.exports = ReactComponentEnvironment;
\No newline at end of file