您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

actions.ts 987B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { SET_NETWORK_INFO, _STORE_NETWORK_INFO_CLEANUP } from './actionTypes';
  2. import { NetworkInfo } from './types';
  3. /**
  4. * Up[dates the network info state.
  5. *
  6. * @param {NetworkInfo} networkInfo - The new network state to be set.
  7. * @returns {{
  8. * type: SET_NETWORK_INFO,
  9. * isOnline: boolean,
  10. * networkType: string,
  11. * details: Object
  12. * }}
  13. */
  14. export function setNetworkInfo({ isOnline, networkType, details }: NetworkInfo) {
  15. return {
  16. type: SET_NETWORK_INFO,
  17. isOnline,
  18. networkType,
  19. details
  20. };
  21. }
  22. /**
  23. * Stored the cleanup function used to shutdown the {@code NetworkInfoService}.
  24. *
  25. * @param {Function} cleanup - The cleanup function to be called on {@code APP_WILL_UNMOUNT}.
  26. * @returns {{
  27. * type: _STORE_NETWORK_INFO_CLEANUP,
  28. * cleanup: Function
  29. * }}
  30. * @private
  31. */
  32. export function _storeNetworkInfoCleanup(cleanup?: Function) {
  33. return {
  34. type: _STORE_NETWORK_INFO_CLEANUP,
  35. cleanup
  36. };
  37. }