mirror of
				https://github.com/reduxjs/redux-devtools.git
				synced 2025-10-25 05:01:03 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			603 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			603 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| export const INCREMENT_COUNTER = 'INCREMENT_COUNTER';
 | |
| export const DECREMENT_COUNTER = 'DECREMENT_COUNTER';
 | |
| 
 | |
| export function increment() {
 | |
|   return {
 | |
|     type: INCREMENT_COUNTER,
 | |
|   };
 | |
| }
 | |
| 
 | |
| export function decrement() {
 | |
|   return {
 | |
|     type: DECREMENT_COUNTER,
 | |
|   };
 | |
| }
 | |
| 
 | |
| export function incrementIfOdd() {
 | |
|   return (dispatch, getState) => {
 | |
|     const { counter } = getState();
 | |
| 
 | |
|     if (counter % 2 === 0) {
 | |
|       return;
 | |
|     }
 | |
| 
 | |
|     dispatch(increment());
 | |
|   };
 | |
| }
 | |
| 
 | |
| export function incrementAsync(delay = 1000) {
 | |
|   return (dispatch) => {
 | |
|     setTimeout(() => {
 | |
|       dispatch(increment());
 | |
|     }, delay);
 | |
|   };
 | |
| }
 |