jsaddle-0.2.0.0: High level interface for webkit-javascriptcore

Safe HaskellNone
LanguageHaskell2010

Language.Javascript.JSaddle.Monad

Contents

Description

JSM monad keeps track of the JavaScript context

Synopsis

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

Running JSaddle given a DOM Window

runJSaddle :: w -> JSM a -> IO a Source

runJSaddle_ :: w -> 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.

catch :: (MonadIO m, Exception e) => ReaderT r IO b -> (e -> ReaderT r IO b) -> ReaderT r m b Source

Wrapped version of catch that runs in a MonadIO that works a bit better with JSM