on d6acea8 help sign in
elk/libraries/JavaScript.elm
55 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
11data JSObject = JSObject
13-- Requires that the input array be uniform (all members have the same type)
14toList : JSArray a -> [a]
15toList = Native.toList
17toInt : JSNumber -> Int
18toInt = Native.toInt
20toFloat : JSNumber -> Float
21toFloat = Native.toFloat
23toBool : JSBool -> Bool
24toBool = Native.toBool
26toString : JSString -> String
27toString = Native.toString
30-- Produces a uniform JavaScript array with all members of the same type.
31fromList : [a] -> JSArray a
32fromList = Native.fromList
34fromInt : Int -> JSNumber
35fromInt = Native.fromInt
37fromFloat : Float -> JSNumber
38fromFloat = Native.fromFloat
40fromBool : Bool -> JSBool
41fromBool = Native.fromBool
43fromString : String -> JSString
44fromString = Native.fromString
47-- Turn an `Element` into a plain old DOM node.
48fromElement : Element -> JSDomNode
49fromElement = Native.fromElement
51-- Turn a DOM node into an `Element`. You can resize the node
52-- using the normal `width` and `height` functions.
53toElement : Int -> Int -> JSDomNode -> Element
54toElement = Native.toElement