jsaddle-0.5.0.1: Interface for JavaScript that works with GHCJS and GHC

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

data JSContextRef Source #

Instances

MakeArgs arg => MakeArgs (JSM arg) Source # 

Methods

makeArgs :: JSM arg -> JSM [JSVal] Source #

Running JSaddle given a JSContextRef

run :: Int -> JSM () -> IO () Source #

Exception Handling

syncPoint :: JSM () Source #

Forces execution of pending asyncronous code

syncAfter :: JSM a -> JSM a Source #

Forces execution of pending asyncronous code after performing f

catch :: Exception e => JSM b -> (e -> JSM b) -> JSM b Source #

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

bracket :: JSM a -> (a -> JSM b) -> (a -> JSM c) -> JSM c Source #

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