Module

Flame.Application.Effectful

Package
purescript-flame
Repository
easafe/purescript-flame

Run a flame application with unbounded side effects

The update function carries context information and runs on Aff

#Application Source

type Application model message = App model message (init :: Tuple model (Maybe message), update :: AffUpdate model message)

Application contains

  • init – the initial model and an optional message to invoke update with
  • view – a function to update your markup
  • update – a function to update your model
  • subscribe – list of external events

#mount Source

mount :: forall id model message. Show id => QuerySelector -> AppId id message -> Application model message -> Effect Unit

Mount a Flame application that can be fed arbitrary external messages

#mount_ Source

mount_ :: forall model message. QuerySelector -> Application model message -> Effect Unit

Mount a Flame application on the given selector

#AffUpdate Source

type AffUpdate model message = Environment model message -> Aff (model -> model)

#Environment Source

type Environment model message = { display :: (model -> model) -> Aff Unit, message :: message, model :: model }

Environment contains context information for Application.update

  • model – the current model
  • message – the current message
  • view – forcefully update view with given model changes

#ResumedApplication Source

type ResumedApplication model message = App model message (init :: Maybe message, update :: AffUpdate model message)

ResumedApplication contains

  • init – initial list of messages to invoke update with
  • view – a function to update your markup
  • update – a function to update your model
  • subscribe – list of external events

#resumeMount Source

resumeMount :: forall id model message. UnserializeState model => Show id => QuerySelector -> AppId id message -> ResumedApplication model message -> Effect Unit

Mount on the given selector a Flame application which was rendered server-side and can be fed arbitrary external messages

#resumeMount_ Source

resumeMount_ :: forall model message. UnserializeState model => QuerySelector -> ResumedApplication model message -> Effect Unit

Mount a Flame application on the given selector which was rendered server-side

#noChanges Source

noChanges :: forall model. Aff (model -> model)

#Diff Source

class Diff changed model  where

Convenience type class to update only the given fields of a model

Members

  • diff' :: changed -> (model -> model)

Instances

#diff Source

diff :: forall changed model. Diff changed model => changed -> Aff (model -> model)

Wraps diff' in Aff