Nessuna descrizione

net.js 955B

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