elm/libraries/JavaScript.elm

56 lines
1.3 KiB
Elm
Raw Normal View History

module JavaScript where
import Native.JavaScript
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
-- 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]
toList = Native.JavaScript.toList
2013-07-26 09:42:00 +00:00
toInt : JSNumber -> Int
toInt = Native.JavaScript.toInt
2013-07-26 09:42:00 +00:00
toFloat : JSNumber -> Float
toFloat = Native.JavaScript.toFloat
2013-07-26 09:42:00 +00:00
toBool : JSBool -> Bool
toBool = Native.JavaScript.toBool
2013-07-26 09:42:00 +00:00
toString : JSString -> String
toString = Native.JavaScript.toString
-- Produces a uniform JavaScript array with all members of the same type.
2013-03-10 08:54:37 +00:00
fromList : [a] -> JSArray a
fromList = Native.JavaScript.fromList
2013-07-26 09:42:00 +00:00
fromInt : Int -> JSNumber
fromInt = Native.JavaScript.fromInt
2013-07-26 09:42:00 +00:00
fromFloat : Float -> JSNumber
fromFloat = Native.JavaScript.fromFloat
2013-07-26 09:42:00 +00:00
fromBool : Bool -> JSBool
fromBool = Native.JavaScript.fromBool
2013-07-26 09:42:00 +00:00
fromString : String -> JSString
fromString = Native.JavaScript.fromString
{--
-- Turn an `Element` into a plain old DOM node.
fromElement : Element -> JSDomNode
fromElement = Native.JavaScript.fromElement
-- Turn a DOM node into an `Element`. You can resize the node
-- using the normal `width` and `height` functions.
toElement : Int -> Int -> JSDomNode -> Element
toElement = Native.JavaScript.toElement
--}