JSInspector.js 857 B

123456789101112131415161718192021222324252627282930313233343536
  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. import type {EventSender} from './InspectorAgent';
  12. interface Agent {
  13. constructor(eventSender: EventSender): void;
  14. }
  15. // Flow doesn't support static declarations in interface
  16. type AgentClass = Class<Agent> & {DOMAIN: string, ...};
  17. declare function __registerInspectorAgent(type: AgentClass): void;
  18. declare function __inspectorTimestamp(): number;
  19. const JSInspector = {
  20. registerAgent(type: AgentClass) {
  21. if (global.__registerInspectorAgent) {
  22. global.__registerInspectorAgent(type);
  23. }
  24. },
  25. getTimestamp(): number {
  26. return global.__inspectorTimestamp();
  27. },
  28. };
  29. module.exports = JSInspector;