Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

reducer.js 768B

12345678910111213141516171819202122232425262728293031323334
  1. // @flow
  2. import { ReducerRegistry } from '../redux';
  3. import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
  4. import {
  5. SET_USER_INTERACTION_LISTENER,
  6. USER_INTERACTION_RECEIVED
  7. } from './actionTypes';
  8. ReducerRegistry.register('features/base/user-interaction', (state = {}, action) => {
  9. switch (action.type) {
  10. case APP_WILL_MOUNT:
  11. case APP_WILL_UNMOUNT: {
  12. return {
  13. ...state,
  14. interacted: false
  15. };
  16. }
  17. case SET_USER_INTERACTION_LISTENER:
  18. return {
  19. ...state,
  20. userInteractionListener: action.userInteractionListener
  21. };
  22. case USER_INTERACTION_RECEIVED:
  23. return {
  24. ...state,
  25. interacted: true
  26. };
  27. }
  28. return state;
  29. });