mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add spec for Networking (#24892)
Summary: Part of #24875, adds a spec for Networking. Since `sendRequest` methods are different for both platforms, I had to create 2 spec files as Flow would merge their definitions even when I added `Platform.OS` check ## Changelog [General] [Added] - TM spec for Networking Pull Request resolved: https://github.com/facebook/react-native/pull/24892 Reviewed By: RSNara Differential Revision: D15543067 Pulled By: fkgozali fbshipit-source-id: 2b91114dfa45e7899bbb139656a30a6fd52e31db
This commit is contained in:
committed by
Facebook Github Bot
parent
08efb1d73b
commit
e8037cb942
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {TurboModule} from 'RCTExport';
|
||||
import * as TurboModuleRegistry from 'TurboModuleRegistry';
|
||||
|
||||
type Header = [string, string];
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+sendRequest: (
|
||||
method: string,
|
||||
url: string,
|
||||
requestId: number,
|
||||
headers: Array<Header>,
|
||||
data: Object,
|
||||
responseType: Object, // TODO: Use stricter type.
|
||||
useIncrementalUpdates: boolean,
|
||||
timeout: number,
|
||||
withCredentials: boolean,
|
||||
) => void;
|
||||
+abortRequest: (requestId: number) => void;
|
||||
+clearCookies: (callback: (result: boolean) => mixed) => void;
|
||||
|
||||
// RCTEventEmitter
|
||||
+addListener: (eventName: string) => void;
|
||||
+removeListeners: (count: number) => void;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('Networking');
|
||||
Reference in New Issue
Block a user