forked from wkh237/react-native-fetch-blob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
net.js
36 lines (31 loc) · 955 Bytes
/
net.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2016 wkh237@github. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be
// found in the LICENSE file.
import {
NativeModules,
DeviceEventEmitter,
Platform,
NativeAppEventEmitter,
} from 'react-native'
const RNFetchBlob = NativeModules.RNFetchBlob
/**
* Get cookie according to the given url.
* @param {string} domain Domain of the cookies to be removed, remove all
* @return {Promise<Array<String>>} Cookies of a specific domain.
*/
function getCookies(domain:string):Promise<Array<String>> {
return RNFetchBlob.getCookies(domain || '')
}
/**
* Remove cookies for a specific domain
* @param {?string} domain Domain of the cookies to be removed, remove all
* cookies when this is null.
* @return {Promise<null>}
*/
function removeCookies(domain:?string):Promise<null> {
return RNFetchBlob.removeCookies(domain || '')
}
export default {
getCookies,
removeCookies
}