Do it already?!?!? What's the hold up? Where are we with new notes page in Elm ? I needed to make a list. So here it is, let's go through it.
What’s the hold up
Shut up, where’s my diagram? You promised me a diagram twice, and have failed to deliver both time. And that’s not what we want to do on this show. Truth be told, I was pretty sure it was inaccurate at best, or worst just flat out wrong. So I made a new version and it is posted BEFORE I recorded the show.
Json Encode Maybe
POST over Ports. The trifecta of learning Elm.
Fix image preview size
At this point I’m frustrated that I can’t “peer” into the Elm code, the way I can in JS. This is a very difficult habit to break.
HAHAH, Ports kicking our but
Decoding Json, I like it. There I said it.
Encoding is a bit of a trip, but I think…I get it.
Encoding nested records into JS Object Values!!!!!!! noteEncoder : CreateNote -> Encode.Value noteEncoder newNote = let _ = Debug.log “newNote” newNote in case newNote.image of Nothing -> Encode.object [ ( “noteContent”, Encode.string newNote.content ) ]
Just image -> Encode.object [ ( "noteContent", Encode.string newNote.content ) , ( "image", imageEncoder image ) ]
imageEncoder : Image -> Encode.Value imageEncoder image = Encode.object [ ( “content”, Encode.string image.content ) , ( “name”, Encode.string image.name ) , ( “type”, Encode.string image.fileType ) , ( “size”, Encode.int image.size ) ]