on 32a331b help sign in
elk/libraries/JavaScript.elm
54 lines 1.2 kB history raw
2module JavaScript where
4import Native.JavaScript as Native
6data JSNumber = JSNumber
7data JSBool = JSBool
8data JSString = JSString
9data JSArray a = JSArray a
10data JSDomNode = JSDomNode
12-- Requires that the input array be uniform (all members have the same type)
13toList : JSArray a -> [a]
14toList = Native.toList
16toInt : JSNumber -> Int
17toInt = Native.toInt
19toFloat : JSNumber -> Float
20toFloat = Native.toFloat
22toBool : JSBool -> Bool
23toBool = Native.toBool
25toString : JSString -> String
26toString = Native.toString
29-- Produces a uniform JavaScript array with all members of the same type.
30fromList : [a] -> JSArray a
31fromList = Native.fromList
33fromInt : Int -> JSNumber
34fromInt = Native.fromInt
36fromFloat : Float -> JSNumber
37fromFloat = Native.fromFloat
39fromBool : Bool -> JSBool
40fromBool = Native.fromBool
42fromString : String -> JSString
43fromString = Native.fromString
46-- Turn an `Element` into a plain old DOM node.
47fromElement : Element -> JSDomNode
48fromElement = Native.fromElement
50-- Turn a DOM node into an `Element`. You can resize the node
51-- using the normal `width` and `height` functions.
52toElement : Int -> Int -> JSDomNode -> Element
53toElement = Native.toElement