Last active
March 23, 2016 21:06
-
-
Save Chadtech/2dab0e65986a516e3a30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| main = document.getElementById 'main' | |
| app = Elm.embed Elm.Main, main | |
| backEnd = (msg) -> | |
| # ... | |
| {submitEmail, updateEmail} = app.ports | |
| email = "ye" | |
| submitEmail.subscribe (what) -> | |
| console.log 'Submit Email!', what, email | |
| backEnd email: email | |
| updateEmail.subscribe (what) -> | |
| console.log 'Update Email!', what | |
| email = what |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- .. | |
| email : String -> Address Action -> Html | |
| email content address = | |
| div | |
| [ style | |
| [ ("margin", "auto") | |
| , ("width", "60%") | |
| ] | |
| ] | |
| [ input | |
| [ class "field" | |
| , placeholder "enter your email here" | |
| , value content | |
| , on "input" targetValue | |
| <| message inputString.address | |
| --<| (\string -> Signal.message address (EmailField string)) | |
| ] | |
| [] | |
| , button | |
| [ style | |
| [ ("background-color", "#030907") | |
| , ("border", "none" ) | |
| , ("outline", "none" ) | |
| ] | |
| , class "point link" | |
| , on "click" targetValue | |
| <| message subscribePress.address | |
| ] | |
| [ text "subscribe" ] | |
| ] | |
| port submitEmail : Signal String | |
| port submitEmail = | |
| Signal.map (\str -> str) subscribePress.signal | |
| port updateEmail : Signal String | |
| port updateEmail = | |
| Signal.map (\str -> str) inputString.signal | |
| inputString : Mailbox String | |
| inputString = mailbox "these strings dont matter" | |
| subscribePress : Mailbox String | |
| subscribePress = mailbox "hell ye mf" | |
| - .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment