on master help sign in
Get the touch library working, and bump the version number to 0.7.1.
c0deb91evancz
core-js/Signal/Touch.js+21−18
@@ -2,23 +2,26 @@
2Elm.Touch = function() {
2Elm.Touch = function() {
3 var touches = Elm.Signal.constant(["Nil"]);
3 var touches = Elm.Signal.constant(["Nil"]);
4
4
5− Value.addListener(document, "touchstart", function(e) {
5+ function touch(t) {
6− var ts = e.changedTouches;
6+ return {_ : [true], x: [t.pageX], y: [t.pageY], id: [t.identifier] };
7− var vs = touches.value;
8− for (var i = ts.length; i--; ) {
9− var t = ts[i];
10− vs = ["Cons", Value.tuple(t.pageX, t.pageY), vs];
11− }
12− Dispatcher.notify(touches.id, vs);
13− });
14− Value.addListener(document, "touchend", function(e) {
15− });
16− Value.addListener(document, "touchcancel", function(e) {
17− });
18− Value.addListener(document, "touchleave", function(e) {
19− });
20− Value.addListener(document, "touchmove", function(e) {
21− });
7+ }
22
8
9+ function listen(name) {
10+ function update(e) {
11+ var ts = Elm.JavaScript.castJSArrayToList(e.touches);
12+ var hasListener = Dispatcher.notify(touches.id, Elm.List.map(touch)(ts));
13+ if (!hasListener)
14+ return this.removeEventListener(name,arguments.callee,false);
15+ e.preventDefault();
16+ }
17+ Value.addListener(document, name, update);
18+ }
19+
20+ listen("touchstart");
21+ listen("touchmove");
22+ listen("touchend");
23+ listen("touchcancel");
24+ listen("touchleave");
25+
23− return {};
26+ return { touches: touches };
24}();
27}();
core-js/cat.bat+2−2
@@ -1,5 +1,5 @@
1−copy /B Guid.js+foreign\JavaScript.js+foreign\JSON.js+Value.js+List.js+Maybe.js+Char.js+Graphics\Color.js+Graphics\Collage.js+Graphics\Element.js+Text.js+Graphics\Render.js+runtime\Signal.js+runtime\Dispatcher.js+Signal\HTTP.js+Signal\Input.js+Signal\Keyboard.js+Signal\Mouse.js+Signal\Random.js+Signal\Time.js+Signal\Window.js+Date.js+Prelude.js+Dict.js+Set.js+Automaton.js ..\elm-mini.js
1+copy /B Guid.js+foreign\JavaScript.js+foreign\JSON.js+Value.js+List.js+Maybe.js+Char.js+Graphics\Color.js+Graphics\Collage.js+Graphics\Element.js+Text.js+Graphics\Render.js+runtime\Signal.js+runtime\Dispatcher.js+Signal\HTTP.js+Signal\Input.js+Signal\Keyboard.js+Signal\Mouse.js+Signal\Touch.js+Signal\Random.js+Signal\Time.js+Signal\Window.js+Date.js+Prelude.js+Dict.js+Set.js+Automaton.js ..\elm-mini.js
2
2
3cd ..\elm
3cd ..\elm
4
4
5−copy /B ..\elm-mini.js elm-runtime-0.7.0.1.js
5+copy /B ..\elm-mini.js elm-runtime-0.7.1.js
elm/Elm.cabal+2−2
@@ -1,6 +1,6 @@
1
1
2Name: Elm
2Name: Elm
3−Version: 0.7.0.1
3+Version: 0.7.1
4Synopsis: The Elm language module.
4Synopsis: The Elm language module.
5Description: Elm aims to make client-side web-development more pleasant.
5Description: Elm aims to make client-side web-development more pleasant.
6 It is a statically/strongly typed, functional reactive
6 It is a statically/strongly typed, functional reactive
@@ -22,7 +22,7 @@ Category: Compiler, Language
22Build-type: Simple
22Build-type: Simple
23
23
24Extra-source-files: changelog.txt
24Extra-source-files: changelog.txt
25−Data-files: elm-runtime-0.7.0.1.js
25+Data-files: elm-runtime-0.7.1.js
26Cabal-version: >=1.8
26Cabal-version: >=1.8
27
27
28source-repository head
28source-repository head