on cbaff88 help sign in
elk/libraries/JavaScript.elm
56 lines 1.4 kB history raw
2module JavaScript where
4import Native.JavaScript
5import open Basics
7data JSNumber = JSNumber
8data JSBool = JSBool
9data JSString = JSString
10data JSArray a = JSArray a
11data JSDomNode = JSDomNode
12data JSObject = JSObject
14-- Requires that the input array be uniform (all members have the same type)
15toList : JSArray a -> [a]
16toList = Native.JavaScript.toList
18toInt : JSNumber -> Int
19toInt = Native.JavaScript.toInt
21toFloat : JSNumber -> Float
22toFloat = Native.JavaScript.toFloat
24toBool : JSBool -> Bool
25toBool = Native.JavaScript.toBool
27toString : JSString -> String
28toString = Native.JavaScript.toString
31-- Produces a uniform JavaScript array with all members of the same type.
32fromList : [a] -> JSArray a
33fromList = Native.JavaScript.fromList
35fromInt : Int -> JSNumber
36fromInt = Native.JavaScript.fromInt
38fromFloat : Float -> JSNumber
39fromFloat = Native.JavaScript.fromFloat
41fromBool : Bool -> JSBool
42fromBool = Native.JavaScript.fromBool
44fromString : String -> JSString
45fromString = Native.JavaScript.fromString
47{--
48-- Turn an `Element` into a plain old DOM node.
49fromElement : Element -> JSDomNode
50fromElement = Native.JavaScript.fromElement
52-- Turn a DOM node into an `Element`. You can resize the node
53-- using the normal `width` and `height` functions.
54toElement : Int -> Int -> JSDomNode -> Element
55toElement = Native.JavaScript.toElement
56--}