on master help sign in
Correct bug in jsevent import. Fix some of the pre-compiled examples.
962e6acevancz
Examples/elm-js/FrameRate/FrameRate.elm+5−5
@@ -1,10 +1,10 @@
1
1
2module FrameRate where
2module FrameRate where
3
3
4−import Data.Maybe (mapMaybe)
4+import Maybe (mapMaybe)
5−import Foreign.JavaScript
5+import JavaScript
6−import Signal.Keyboard.Raw
6+import Keyboard.Raw
7−import Signal.Input
7+import Input
8
8
9(drop,dFPS) = dropDown
9(drop,dFPS) = dropDown
10 [ ( "30", 30)
10 [ ( "30", 30)
@@ -58,7 +58,7 @@ position = foldp addVecs (0,0) delta
58screen pos actual =
58screen pos actual =
59 flow down [ collage 400 400 [ outlined black (rect 40 40 pos) ]
59 flow down [ collage 400 400 [ outlined black (rect 40 40 pos) ]
60 , plainText "Move the square around with the arrow keys."
60 , plainText "Move the square around with the arrow keys."
61− , text $ toText "Actual frames per second: " ++ show actual
61+ , plainText $ "Actual frames per second: " ++ show actual
62 , plainText "Desired frames per second: " `beside` drop
62 , plainText "Desired frames per second: " `beside` drop
63 ]
63 ]
64
64
Examples/elm-js/Maps/Map.elm+2−2
@@ -1,8 +1,8 @@
1
1
2module Map where
2module Map where
3
3
4−import Signal.Window as Win
4+import Window as Win
5−import Foreign.JavaScript.Experimental
5+import JavaScript.Experimental
6
6
7foreign import jsevent "provideMap"
7foreign import jsevent "provideMap"
8 (castElementToJSElement $ spacer 640 360)
8 (castElementToJSElement $ spacer 640 360)
Examples/elm-js/Pong/Pong.elm+3−3
@@ -55,9 +55,9 @@
55
55
56module Pong where
56module Pong where
57
57
58−import Foreign.JavaScript
58+import JavaScript
59−import Signal.Keyboard.Raw
59+import Keyboard.Raw
60−import Signal.Window as Win
60+import Window as Win
61
61
62
62
63------------------------------------------------------------------------
63------------------------------------------------------------------------
elm/elm-runtime-0.5.0.js+4−2
@@ -75,6 +75,7 @@ Elm.JavaScript = function() {
75}();
75}();
76
76
77var Elm = Elm || {};
77var Elm = Elm || {};
78+var JSjson = JSON;
78Elm.JSON = function() {
79Elm.JSON = function() {
79 var JS = Elm.JavaScript;
80 var JS = Elm.JavaScript;
80 var empty = ['JSON',{}];
81 var empty = ['JSON',{}];
@@ -163,11 +164,11 @@ Elm.JSON = function() {
163 return v[1];
164 return v[1];
164 }
165 }
165 }
166 }
166− return JSON.stringify(fromValue([ 'JsonObject', obj ]), null, JS.castStringToJSString(sep));
167+ return JSjson.stringify(fromValue([ 'JsonObject', obj ]), null, JS.castStringToJSString(sep));
167 };
168 };
168 }
169 }
169 function fromJSString(str) {
170 function fromJSString(str) {
170− var obj = JSON.parse(str);
171+ var obj = JSjson.parse(str);
171 function toValue(v) {
172 function toValue(v) {
172 switch (typeof v) {
173 switch (typeof v) {
173 case 'string' : return [ "JsonString", JS.castJSStringToString(v) ];
174 case 'string' : return [ "JsonString", JS.castJSStringToString(v) ];
@@ -210,6 +211,7 @@ Elm.JSON = function() {
210 JsonObject : JsonObject
211 JsonObject : JsonObject
211 };
212 };
212}();
213}();
214+
213var Value = function(){
215var Value = function(){
214
216
215 var eq = function(x,y) {
217 var eq = function(x,y) {
elm/src/Gen/CompileToJS.hs+2−2
@@ -117,8 +117,8 @@ stmtToJS (Datatype _ _ tcs) = concatMap (stmtToJS . toDef) tcs
117 where toDef (name,args) = Def name vars $ Data (derename name) (map Var vars)
117 where toDef (name,args) = Def name vars $ Data (derename name) (map Var vars)
118 where vars = map (('a':) . show) [1..length args]
118 where vars = map (('a':) . show) [1..length args]
119stmtToJS (ImportEvent js base elm _) =
119stmtToJS (ImportEvent js base elm _) =
120− concat [ "\nvar " ++ elm ++ " = Elm.Input(" ++ toJS base ++ ");"
120+ concat [ "\nvar " ++ elm ++ " = Elm.Signal.constant(" ++ toJS base ++ ");"
121− , "\nSignal.addListener(document, '" ++ js
121+ , "\nValue.addListener(document, '" ++ js
122 , "', function(e) { Dispatcher.notify(" ++ elm
122 , "', function(e) { Dispatcher.notify(" ++ elm
123 , ".id, e.value); });" ]
123 , ".id, e.value); });" ]
124stmtToJS (ExportEvent js elm _) =
124stmtToJS (ExportEvent js elm _) =