/**1* Copyright 2014-2015, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @providesModule ReactComponentEnvironment9*/1011'use strict';1213var invariant = require("./invariant");1415var injected = false;1617var ReactComponentEnvironment = {1819/**20* Optionally injectable environment dependent cleanup hook. (server vs.21* browser etc). Example: A browser system caches DOM nodes based on component22* ID and must remove that cache entry when this instance is unmounted.23*/24unmountIDFromEnvironment: null,2526/**27* Optionally injectable hook for swapping out mount images in the middle of28* the tree.29*/30replaceNodeWithMarkupByID: null,3132/**33* Optionally injectable hook for processing a queue of child updates. Will34* later move into MultiChildComponents.35*/36processChildrenUpdates: null,3738injection: {39injectEnvironment: function(environment) {40("production" !== process.env.NODE_ENV ? invariant(41!injected,42'ReactCompositeComponent: injectEnvironment() can only be called once.'43) : invariant(!injected));44ReactComponentEnvironment.unmountIDFromEnvironment =45environment.unmountIDFromEnvironment;46ReactComponentEnvironment.replaceNodeWithMarkupByID =47environment.replaceNodeWithMarkupByID;48ReactComponentEnvironment.processChildrenUpdates =49environment.processChildrenUpdates;50injected = true;51}52}5354};5556module.exports = ReactComponentEnvironment;575859