on master help sign in
Make sure Mouse, Random, Window, and Time import their native implementation.
commit1552651eafa50d83ef5e9ef2fbb381e3fe896a81 authorevancz <info@elm-lang.org> dateWed 13 Mar 2013, 00:00 (14 years ago) parent3540449
5 files changed+14−2
libraries/Mouse.elm+2 libraries/Native/Graphics/Text.js+6−2 libraries/Random.elm+2 libraries/Time.elm+2 libraries/Window.elm+2
libraries/Mouse.elm+2
@@ -1,6 +1,8 @@
11
22module Mouse where
33
4+import Native.Mouse
5+
46-- The current mouse position.
57position : Signal (Int,Int)
68
libraries/Native/Graphics/Text.js+6−2
@@ -10,6 +10,7 @@ Elm.Native.Graphics.Text = function(elm) {
1010 var htmlHeight = Elm.Native.Utils(elm).htmlHeight;
1111 var Color = Elm.Native.Graphics.Color(elm);
1212 var Element = Elm.Graphics.Element(elm);
13+ var show = Elm.Native.Show(elm).show;
1314
1415 function makeSpaces(s) {
1516 if (s.length == 0) { return s; }
@@ -66,6 +67,9 @@ Elm.Native.Graphics.Text = function(elm) {
6667 function typeface(name, text) {
6768 return addStyle('font-family', JS.fromString(name), text);
6869 }
70+ function monospace(text) {
71+ return addStyle('font-family', 'monospace', text);
72+ }
6973 function size(px, text) { return addStyle('font-size', px + 'px', text) }
7074 var header = addTag('h1');
7175 function height(h, text) { return addStyle('font-size', hf+'em', text) }
@@ -94,7 +98,7 @@ Elm.Native.Graphics.Text = function(elm) {
9498 }
9599
96100 function asText(v) {
97− return position('left')(typeface('monospace', toText(show(v))));
101+ return position('left')(monospace(toText(show(v))));
98102 }
99103
100104 return elm.Native.Graphics.Text = {
@@ -107,7 +111,7 @@ Elm.Native.Graphics.Text = function(elm) {
107111 underline : underline,
108112 overline : overline,
109113 strikeThrough : strikeThrough,
110− monospace : function(text) { return typeface('monospace', text) },
114+ monospace : monospace,
111115 typeface : F2(typeface),
112116 color : F2(color),
113117 link : F2(link),
libraries/Random.elm+2
@@ -1,6 +1,8 @@
11
22module Random where
33
4+import Native.Random
5+
46-- Given a range from low to high and a signal of values, this produces
57-- a new signal that changes whenever the input signal changes. The new
68-- values are random number between 'low' and 'high' inclusive.
libraries/Time.elm+2
@@ -3,6 +3,8 @@
33
44module Time where
55
6+import Native.Time
7+
68type Time = Float
79
810-- Units of time, making it easier to specify things like a
libraries/Window.elm+2
@@ -1,6 +1,8 @@
11
22module Window where
33
4+import Native.Mouse
5+
46-- The current dimensions of the window (i.e. the area viewable to the
57-- user, not including scroll bars).
68dimensions : Signal (Int,Int)