You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.js 1017B

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