Created
July 16, 2012 12:44
-
-
Save RudolfVonKrugstein/3122489 to your computer and use it in GitHub Desktop.
UHC get context2d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Document | |
data Context2D | |
data Canvas | |
foreign import js "document" | |
document :: IO Document | |
foreign import js "%1.getElementById(%2)" | |
jsGetElementById :: Document -> JSString -> IO Canvas | |
getElementById doc = jsGetElementById doc . toJS | |
foreign import js "%1.getContext('2d')" | |
getContext2dFromCanvas :: Canvas -> IO Context2D | |
getContext2d :: String -> IO Context2D | |
getContext2d canvasName = do | |
d <- document | |
c <- getElementById d canvasName | |
getContext2dFromCanvas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment