-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The code in 'src/Main.elm' is taken verbatim from pravdomil's comment 'elm/virtual-dom#178 (comment)'.
- Loading branch information
0 parents
commit ed94a72
Showing
5 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
elm-stuff | ||
dist |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env sh | ||
set -eux | ||
elm make ./src/Main.elm --output=./dist/main.js |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"type": "application", | ||
"source-directories": [ | ||
"src" | ||
], | ||
"elm-version": "0.19.1", | ||
"dependencies": { | ||
"direct": { | ||
"elm/browser": "1.0.2", | ||
"elm/core": "1.0.5", | ||
"elm/html": "1.0.0" | ||
}, | ||
"indirect": { | ||
"elm/json": "1.1.3", | ||
"elm/time": "1.0.0", | ||
"elm/url": "1.0.0", | ||
"elm/virtual-dom": "1.0.3" | ||
} | ||
}, | ||
"test-dependencies": { | ||
"direct": {}, | ||
"indirect": {} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Test</title> | ||
<script src="./dist/main.js"></script> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script>Elm.Main.init({node: document.getElementById('app')})</script> | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module Main exposing (..) | ||
|
||
import Browser | ||
import Html exposing (..) | ||
import Html.Attributes exposing (..) | ||
import Html.Events exposing (..) | ||
import Html.Keyed | ||
|
||
|
||
main : Program () Bool () | ||
main = | ||
Browser.sandbox | ||
{ init = False | ||
, view = view | ||
, update = always not | ||
} | ||
|
||
|
||
view : Bool -> Html () | ||
view model = | ||
div [] | ||
[ Html.Keyed.node "div" | ||
[] | ||
([ input_ "A" | ||
, input_ "B" | ||
] | ||
|> (\x -> | ||
if model then | ||
List.reverse x | ||
|
||
else | ||
x | ||
) | ||
) | ||
, text "Type to swaps inputs." | ||
] | ||
|
||
|
||
input_ a = | ||
( a | ||
, input | ||
[ id a | ||
, value a | ||
, onInput (\_ -> ()) | ||
] | ||
[] | ||
) |