dwyl / learn-elm-architecture-in-javascript

:unicorn: Learn how to build web apps using the Elm Architecture in "vanilla" JavaScript (step-by-step TDD tutorial)!
https://todomvc-app.herokuapp.com
GNU General Public License v2.0
213 stars 19 forks source link

Do we *need* to "init"? #49

Closed nelsonic closed 6 years ago

nelsonic commented 6 years ago

While re-reading the code (and preparing for "elmish") It occurred to me that we might be over-complicating things ...

Do we need an init function to initialise the DOM in: https://github.com/dwyl/learn-elm-architecture-in-javascript/blob/814467e81b1b9739da74378455bd12721b096ebd/examples/counter-reset/counter.js#L69-L85 e.g: https://github.com/dwyl/learn-elm-architecture-in-javascript/blob/075c4c438acda3cc0e6c04fe530b161c4a6c7db5/test/counter-reset.test.js#L10

If we use https://github.com/rstacruz/jsdom-global in our tests, we should not need an init function. I'm going to experiment with updating the counter-reset tests and see if I can remove the init function completely.

nelsonic commented 6 years ago

Testing this now so I can simplify #44

nelsonic commented 6 years ago

Removed it. simplified code. stoked.