Greetings. I'm an OCaml guy, teaching Web Apps for the first time and
finding my way through the insanity that is HTML + CSS + JS and trying to
impart something sensible to students for how to structure their vanilla JS
apps to conform to the the Elm Architecture (model-view-update). First time
through, I'm not savvy enough to know how to properly fake the Elm
Architecture in vanilla JS.
IN PARTICULAR: I'd like to write a simple TODO app where the model is a
record containing a list of todo items and a list of completed items. I'd
like to write the app along the lines of:
let app = {
view : view, // : model -> element
update : update // : model -> model
}
But I'm getting bollixed-up with the basic wiring. It's very basic stuff.
E.g., let's say I have an addItem button; I assume that I want to wire-up
the event listener to deliver the new item to the model (an update).
Obviously these are executed asynchronously. But then what are the proper
manners for displaying the model in the DOM? For a simple synchronous
8-queens solver example that I did, I wrote a reasonable runApp function
using the JS setInterval function. But I'm not sure if this is kosher for
the asynchronous case.
Any advice here? Any pointers to Vanilla JS examples written using the Elm
Architecture?
Thank you! Your reply would help me and my 60 students!
Bob Muller
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.