Created
April 9, 2015 19:34
-
-
Save johncant/ce2fdf37713396dba069 to your computer and use it in GitHub Desktop.
GHCJS call callback synchronously [FAIL]
This file contains hidden or 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
import GHCJS.Foreign | |
import GHCJS.Types | |
data DontTouchThis | |
foreign import javascript "js_testFunc" js_testFunc :: JSFun (JSRef DontTouchThis -> IO JSString) -> IO () | |
main :: IO () | |
main = js_testFunc =<< syncCallback1 AlwaysRetain True (\_ -> putStrLn "bar" >> return (toJSString "quux")) |
This file contains hidden or 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
js_testFunc = function(cb) { | |
window.setTimeout(function() { | |
debugger // Good luck | |
// cb("foo") returns null, h$runSync and most other things throws an error or returns null | |
}, 1000) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment