PHP 7.4.33
Preview: RCTNetworking.ios.js Size: 1.79 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/react-native/Libraries/Network/RCTNetworking.ios.js
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict-local
 * @format
 */

'use strict';

import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
import convertRequestBody, {type RequestBody} from './convertRequestBody';
import NativeNetworkingIOS from './NativeNetworkingIOS';
import {type RCTNetworkingEventDefinitions} from './RCTNetworkingEventDefinitions.flow';
import {type NativeResponseType} from './XMLHttpRequest';

const RCTNetworking = {
  addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
    eventType: K,
    listener: (...$ElementType<RCTNetworkingEventDefinitions, K>) => mixed,
    context?: mixed,
  ): EventSubscription {
    // $FlowFixMe[incompatible-call]
    return RCTDeviceEventEmitter.addListener(eventType, listener, context);
  },

  sendRequest(
    method: string,
    trackingName: string,
    url: string,
    headers: {...},
    data: RequestBody,
    responseType: NativeResponseType,
    incrementalUpdates: boolean,
    timeout: number,
    callback: (requestId: number) => void,
    withCredentials: boolean,
  ) {
    const body = convertRequestBody(data);
    NativeNetworkingIOS.sendRequest(
      {
        method,
        url,
        data: {...body, trackingName},
        headers,
        responseType,
        incrementalUpdates,
        timeout,
        withCredentials,
      },
      callback,
    );
  },

  abortRequest(requestId: number) {
    NativeNetworkingIOS.abortRequest(requestId);
  },

  clearCookies(callback: (result: boolean) => void) {
    NativeNetworkingIOS.clearCookies(callback);
  },
};

export default RCTNetworking;

Directory Contents

Dirs: 0 × Files: 24
Name Size Perms Modified Actions
1.01 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
447 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
3.08 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
436 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
420 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
445 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.21 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
441 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.87 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
753 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
6.52 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
3.23 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
2.90 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.79 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.20 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
29.93 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.09 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.04 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1018 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.78 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
5.63 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
2.32 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
6.31 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
18.81 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).