this question has answer here:
- trigger action update function 1 answer
i've following action handler in update function of elm startapp muv framework.
signupalertmailbox : signal.mailbox string signupalertmailbox = signal.mailbox "" update : action -> model -> (model, effects action) update action model = case action of submit -> let isinputvalid = dict.foldl (\fieldname fieldstate validity -> if validity (fieldstate == isokay) else validity) true model.inputstate rnd = log "input valid" isinputvalid -- in (model, effects.none) in if isinputvalid (model, signal.send signupalertmailbox.address "oh snap! change few things , try submitting again." |> effects.task |> effects.map (always submit)) else (model, signal.send signupalertmailbox.address "well done! input correct!" |> effects.task |> effects.map (always submit))
upon submit action, can see log message in browser console, no message being sent signupalertmailbox. please me issue.
-- edit
the startapp wiring code requested in comment below:
import startapp exposing (start) import time exposing (every, second) import pages.signup.model import pages.signup.update exposing (signupalertmailbox) import pages.signup.view app = start { init = pages.signup.model.init , view = pages.signup.view.view , update = pages.signup.update.update , inputs = [] }
the reason hadnt handed on app.tasks port executed mentioned chad gilbert @chad-gilbert in comment above. thanks!
i added following section , started getting messages in sigupalertmailbox mailbox update function
port tasks : signal (task.task never ()) port tasks = app.tasks
Comments
Post a Comment