Type shared/actions/app.ts

pull/10616/head
Jared Scheib 2018-06-18 14:27:46 -07:00
parent c3b556329d
commit c97fcc48d3
1 changed files with 29 additions and 6 deletions

View File

@ -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<EnablePresentationModeAction>
) => void) => (dispatch: Dispatch<EnablePresentationModeAction>): 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: {},
})