Module

Elmish.TimeMachine.Types.History

Package
purescript-elmish-time-machine
Repository
mcordova47/purescript-elmish-time-machine

#History Source

newtype History msg s

A zipper type that allows easy traversal through pairs of states and messages in an Elmish UI

#future Source

future :: forall msg s. History msg s -> Array (IndexedEvent msg s)

Gets an array of the future state/message pairs, along with its index (or distance from the present), ordered chronologically

#hasFuture Source

hasFuture :: forall msg s. History msg s -> Boolean

Returns true iff there is a nonempty future

#hasPast Source

hasPast :: forall msg s. History msg s -> Boolean

Returns true iff there is a nonempty past

#init Source

init :: forall msg s. s -> History msg s

Initializes the History type with a current state

#jump Source

jump :: forall msg s. Int -> History msg s -> History msg s

Jumps the given distance, i.e. by a certain number of steps forward or backwards

#latestMessage Source

latestMessage :: forall msg s. History msg s -> Message msg

Gets the latest message

#past Source

past :: forall msg s. History msg s -> Array (IndexedEvent msg s)

Gets an array of the past state/message pairs, along with its index (or distance from the present), ordered chronologically

#play Source

play :: forall msg s. History msg s -> History msg s

Go to the end state of the history

#present Source

present :: forall msg s. History msg s -> Event msg s

Gets the current state paired with the latest message

#presentState Source

presentState :: forall msg s. History msg s -> s

Gets the current state

#redo Source

redo :: forall msg s. History msg s -> History msg s

Steps forward one event into the future No-op if there is no future

#stash Source

stash :: forall msg s. History msg s -> msg -> s -> History msg s

For the case where the history is paused, stash changes in the future

#stop Source

stop :: forall msg s. History msg s -> History msg s

Clears the future state, for when the stop button is pressed

#track Source

track :: forall msg s. History msg s -> msg -> s -> History msg s

Adds a new event to the history, emptying out the future events

#undo Source

undo :: forall msg s. History msg s -> History msg s

Steps back one event into the past No-op if there is no past