Module
Oak
- Package
- purescript-oak
- Repository
- ehrenmurdick/purescript-oak
#createApp Source
createApp :: forall flags c model msg. { init :: flags -> model, next :: msg -> model -> Cmd c msg, update :: msg -> model -> model, view :: model -> Html msg } -> App c model msg flagscreateApp takes a record with a description of your Oak app. It has a few parts:
init:
A function from you flags type to the inital model state.
Flags type can be Unit if you don't need this for anything.
view:
Maps the current model to an html view.
next:
This function maps a message and model to a command. For example,
for sending an Http request when a user clicks a button.
next would be called with the button click message and would
return an Oak.Cmd that will execute the request.
update:
Takes an incoming message, and the previous model state, and returns the new model state.