1/** 2 * Copyright 2013-2014, 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 * @providesModule ServerReactRootIndex 10 * @typechecks 11 */ 12 13"use strict"; 14 15/** 16 * Size of the reactRoot ID space. We generate random numbers for React root 17 * IDs and if there's a collision the events and DOM update system will 18 * get confused. In the future we need a way to generate GUIDs but for 19 * now this will work on a smaller scale. 20 */ 21var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53); 22 23var ServerReactRootIndex = { 24 createReactRootIndex: function() { 25 return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX); 26 } 27}; 28 29module.exports = ServerReactRootIndex; 30 31