BatchedBridge.js 870 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow strict-local
  9. */
  10. 'use strict';
  11. const MessageQueue = require('./MessageQueue');
  12. const BatchedBridge: MessageQueue = new MessageQueue();
  13. // Wire up the batched bridge on the global object so that we can call into it.
  14. // Ideally, this would be the inverse relationship. I.e. the native environment
  15. // provides this global directly with its script embedded. Then this module
  16. // would export it. A possible fix would be to trim the dependencies in
  17. // MessageQueue to its minimal features and embed that in the native runtime.
  18. Object.defineProperty(global, '__fbBatchedBridge', {
  19. configurable: true,
  20. value: BatchedBridge,
  21. });
  22. module.exports = BatchedBridge;