2013-02-27 07:26:28 +00:00
|
|
|
|
|
|
|
module JavaScript where
|
|
|
|
|
2013-07-29 21:23:04 +00:00
|
|
|
import Native.JavaScript
|
2013-07-29 13:49:19 +00:00
|
|
|
import open Basics
|
2013-07-26 09:42:00 +00:00
|
|
|
|
|
|
|
data JSNumber = JSNumber
|
|
|
|
data JSBool = JSBool
|
|
|
|
data JSString = JSString
|
|
|
|
data JSArray a = JSArray a
|
|
|
|
data JSDomNode = JSDomNode
|
2013-07-26 14:38:11 +00:00
|
|
|
data JSObject = JSObject
|
2013-03-03 05:43:44 +00:00
|
|
|
|
2013-03-24 12:45:56 +00:00
|
|
|
-- Requires that the input array be uniform (all members have the same type)
|
2013-03-10 08:54:37 +00:00
|
|
|
toList : JSArray a -> [a]
|
2013-07-29 21:23:04 +00:00
|
|
|
toList = Native.JavaScript.toList
|
2013-07-26 09:42:00 +00:00
|
|
|
|
2013-03-03 05:43:44 +00:00
|
|
|
toInt : JSNumber -> Int
|
2013-07-29 21:23:04 +00:00
|
|
|
toInt = Native.JavaScript.toInt
|
2013-07-26 09:42:00 +00:00
|
|
|
|
2013-03-03 05:43:44 +00:00
|
|
|
toFloat : JSNumber -> Float
|
2013-07-29 21:23:04 +00:00
|
|
|
toFloat = Native.JavaScript.toFloat
|
2013-07-26 09:42:00 +00:00
|
|
|
|
2013-03-03 05:43:44 +00:00
|
|
|
toBool : JSBool -> Bool
|
2013-07-29 21:23:04 +00:00
|
|
|
toBool = Native.JavaScript.toBool
|
2013-07-26 09:42:00 +00:00
|
|
|
|
2013-05-17 20:46:08 +00:00
|
|
|
toString : JSString -> String
|
2013-07-29 21:23:04 +00:00
|
|
|
toString = Native.JavaScript.toString
|
2013-03-03 05:43:44 +00:00
|
|
|
|
|
|
|
|
2013-03-24 12:45:56 +00:00
|
|
|
-- Produces a uniform JavaScript array with all members of the same type.
|
2013-03-10 08:54:37 +00:00
|
|
|
fromList : [a] -> JSArray a
|
2013-07-29 21:23:04 +00:00
|
|
|
fromList = Native.JavaScript.fromList
|
2013-07-26 09:42:00 +00:00
|
|
|
|
2013-03-03 05:43:44 +00:00
|
|
|
fromInt : Int -> JSNumber
|
2013-07-29 21:23:04 +00:00
|
|
|
fromInt = Native.JavaScript.fromInt
|
2013-07-26 09:42:00 +00:00
|
|
|
|
2013-03-03 05:43:44 +00:00
|
|
|
fromFloat : Float -> JSNumber
|
2013-07-29 21:23:04 +00:00
|
|
|
fromFloat = Native.JavaScript.fromFloat
|
2013-07-26 09:42:00 +00:00
|
|
|
|
2013-03-03 05:43:44 +00:00
|
|
|
fromBool : Bool -> JSBool
|
2013-07-29 21:23:04 +00:00
|
|
|
fromBool = Native.JavaScript.fromBool
|
2013-07-26 09:42:00 +00:00
|
|
|
|
2013-05-17 20:46:08 +00:00
|
|
|
fromString : String -> JSString
|
2013-07-29 21:23:04 +00:00
|
|
|
fromString = Native.JavaScript.fromString
|
2013-03-03 05:43:44 +00:00
|
|
|
|
2013-07-29 13:49:19 +00:00
|
|
|
{--
|
2013-05-17 20:46:08 +00:00
|
|
|
-- Turn an `Element` into a plain old DOM node.
|
|
|
|
fromElement : Element -> JSDomNode
|
2013-07-29 21:23:04 +00:00
|
|
|
fromElement = Native.JavaScript.fromElement
|
2013-03-24 12:45:56 +00:00
|
|
|
|
2013-05-17 20:46:08 +00:00
|
|
|
-- Turn a DOM node into an `Element`. You can resize the node
|
|
|
|
-- using the normal `width` and `height` functions.
|
|
|
|
toElement : Int -> Int -> JSDomNode -> Element
|
2013-07-29 21:23:04 +00:00
|
|
|
toElement = Native.JavaScript.toElement
|
2013-07-29 13:49:19 +00:00
|
|
|
--}
|