You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
moduleCounter.MainwhereimportPreludeimportEffect (Effect)
importFlame (Html, QuerySelector(..), Subscription)
-- Side effects free updating; see docs for other examplesimportFlame.Application.NoEffectsasFANimportFlame.Html.ElementasHEimportFlame.Html.AttributeasHA-- | The model represents the state of the apptypeModel=Int-- | Data type used to represent eventsdataMessage = Increment|Decrement-- | Initial state of the appinit::Model
init = 0-- | `update` is called to handle eventsupdate::Model->Message->Model
update model = case _ ofIncrement-> model + 1Decrement-> model - 1-- | `view` is called whenever the model is updatedview::Model->HtmlMessage
view model = HE.main [HA.id "main"] [
HE.button [HA.onClick Decrement] [HE.text "-"],
HE.text $ show model,
HE.button [HA.onClick Increment] [HE.text "+"]
]
-- | Events that come from outside the `view`subscribe::Array (SubscriptionMessage)
subscribe = []-- | Mount the application on the given selectormain::EffectUnit
main = FAN.mount_ (QuerySelector"body") {
init,
view,
update,
subscribe
}
Tools
breeze can be used to generate Flame markup from HTML
Licensing
Licenses for loadash, stage0 and snabbdom-to-html added under licenses since parts of the rendering code was adapted from these projects
Funding
If this project is useful for you, consider throwing a buck to keep development possible
About
Fast & simple framework for building web applications