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

actions.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @flow
  2. import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes';
  3. declare var APP;
  4. /**
  5. * Signals that a specific App will mount (in the terms of React).
  6. *
  7. * @param {App} app - The App which will mount.
  8. * @returns {{
  9. * type: APP_WILL_MOUNT,
  10. * app: App
  11. * }}
  12. */
  13. export function appWillMount(app: Object) {
  14. return (dispatch: Dispatch<*>) => {
  15. dispatch({
  16. type: APP_WILL_MOUNT,
  17. app
  18. });
  19. // TODO There was a redux action creator appInit which I did not like
  20. // because we already had the redux action creator appWillMount and,
  21. // respectively, the redux action APP_WILL_MOUNT. So I set out to remove
  22. // appInit and managed to move everything it was doing but the
  23. // following. Which is not extremely bad because we haven't moved the
  24. // API module into its own feature yet so we're bound to work on that in
  25. // the future.
  26. typeof APP === 'object' && APP.API.init();
  27. };
  28. }
  29. /**
  30. * Signals that a specific App will unmount (in the terms of React).
  31. *
  32. * @param {App} app - The App which will unmount.
  33. * @returns {{
  34. * type: APP_WILL_UNMOUNT,
  35. * app: App
  36. * }}
  37. */
  38. export function appWillUnmount(app: Object) {
  39. return {
  40. type: APP_WILL_UNMOUNT,
  41. app
  42. };
  43. }