Safe Haskell | None |
---|---|
Language | Haskell2010 |
JSC monad keeps track of the JavaScript context
- type JSC = ReaderT JSContextRef IO
- type JSContextRef = Ptr OpaqueJSContext
- runJSC :: WebView -> JSC a -> IO a
- runJSC_ :: WebView -> JSC a -> IO ()
- catchval :: (JSValueRefRef -> JSC a) -> (JSValueRef -> JSC a) -> JSC a
- catch :: (MonadIO m, Exception e) => ReaderT r IO b -> (e -> ReaderT r IO b) -> ReaderT r m b
Types
type JSC = ReaderT JSContextRef IO Source
The JSC
monad keeps track of the JavaScript context.
Given a JSC
function and a JSContextRef
you can run the
function like this...
runReaderT jscFunction javaScriptContext
For an example of how to set up WebKitGTK+ see tests/TestJSC.hs
type JSContextRef = Ptr OpaqueJSContext
Running JSC given a DOM Window
Exception Handling
catchval :: (JSValueRefRef -> JSC a) -> (JSValueRef -> JSC a) -> JSC a Source
Handle JavaScriptCore functions that take a JSValueRefRef in order to throw exceptions.