import { Dispatch } from 'redux' ; import { IWindow , WindowsAction , WindowsActionTypes , } from '../../types/redux/windows-reducer-types' ; Action function param { IWindow } windowParams returns { function } export const openWindow = ( windowParams ) => { return async ( dispatch ) : Promise < void > => { dispatch ( { type : WindowsActionTypes . OPEN_WINDOW , payload : windowParams } ) ; } ; } ; Action function param { string } windowName returns { function } export const closeOpenedWindow = ( windowName ) => { return async ( dispatch ) : Promise < void > => { dispatch ( { type : WindowsActionTypes . CLOSE_WINDOW , payload : windowName , } ) ; setTimeout ( ( ) => dispatch ( { type : WindowsActionTypes . CLEAR_CLOSED_WINDOWS , payload : windowName , } ) , 1000 ) ; } ; } ;