NativeNetworkingAndroid.js 992 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. * @flow
  8. * @format
  9. */
  10. 'use strict';
  11. import type {TurboModule} from '../TurboModule/RCTExport';
  12. import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
  13. type Header = [string, string];
  14. export interface Spec extends TurboModule {
  15. +sendRequest: (
  16. method: string,
  17. url: string,
  18. requestId: number,
  19. headers: Array<Header>,
  20. data: Object,
  21. responseType: string,
  22. useIncrementalUpdates: boolean,
  23. timeout: number,
  24. withCredentials: boolean,
  25. ) => void;
  26. +abortRequest: (requestId: number) => void;
  27. +clearCookies: (callback: (result: boolean) => void) => void;
  28. // RCTEventEmitter
  29. +addListener: (eventName: string) => void;
  30. +removeListeners: (count: number) => void;
  31. }
  32. export default (TurboModuleRegistry.getEnforcing<Spec>('Networking'): Spec);