From c97fcc48d3016c83aa31f86749dd420665745554 Mon Sep 17 00:00:00 2001 From: Jared Scheib Date: Mon, 18 Jun 2018 14:27:46 -0700 Subject: [PATCH] Type shared/actions/app.ts --- ui/src/shared/actions/app.ts | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/ui/src/shared/actions/app.ts b/ui/src/shared/actions/app.ts index df95c736dc..fb0b45c62c 100644 --- a/ui/src/shared/actions/app.ts +++ b/ui/src/shared/actions/app.ts @@ -1,15 +1,25 @@ +import {Dispatch} from 'redux' + import {PRESENTATION_MODE_ANIMATION_DELAY} from '../constants' // ephemeral state action creators -export const enablePresentationMode = () => ({ +interface EnablePresentationModeAction { + type: 'ENABLE_PRESENTATION_MODE' +} +export const enablePresentationMode = (): EnablePresentationModeAction => ({ type: 'ENABLE_PRESENTATION_MODE', }) -export const disablePresentationMode = () => ({ +interface DisablePresentationModeAction { + type: 'DISABLE_PRESENTATION_MODE' +} +export const disablePresentationMode = (): DisablePresentationModeAction => ({ type: 'DISABLE_PRESENTATION_MODE', }) -export const delayEnablePresentationMode = () => dispatch => { +export const delayEnablePresentationMode = (): (( + dispatch: Dispatch +) => void) => (dispatch: Dispatch): void => { setTimeout( () => dispatch(enablePresentationMode()), PRESENTATION_MODE_ANIMATION_DELAY @@ -17,18 +27,31 @@ export const delayEnablePresentationMode = () => dispatch => { } // persistent state action creators -export const setAutoRefresh = milliseconds => ({ +interface SetAutoRefreshAction { + type: 'SET_AUTOREFRESH' + payload: { + milliseconds: number + } +} +export const setAutoRefresh = (milliseconds: number): SetAutoRefreshAction => ({ type: 'SET_AUTOREFRESH', payload: { milliseconds, }, }) -export const templateControlBarVisibilityToggled = () => ({ +interface TemplateControlBarVisibilityToggledAction { + type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED' +} +export const templateControlBarVisibilityToggled = (): TemplateControlBarVisibilityToggledAction => ({ type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED', }) -export const noop = () => ({ +interface NoopAction { + type: 'NOOP' + payload: object +} +export const noop = (): NoopAction => ({ type: 'NOOP', payload: {}, })