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