@@ -19,6 +19,7 @@ module Language.Javascript.JSaddle.Run (
19 , syncAfter
19 , syncAfter
20 , waitForAnimationFrame
20 , waitForAnimationFrame
21 , nextAnimationFrame
21 , nextAnimationFrame
22#ifndef ghcjs_HOST_OS
23#ifndef ghcjs_HOST_OS
23 -- * Functions used to implement JSaddle using JSON messaging
24 -- * Functions used to implement JSaddle using JSON messaging
24 , runJavaScript
25 , runJavaScript
@@ -68,6 +69,16 @@ import Control.DeepSeq (deepseq)
68import GHC.Stats (getGCStatsEnabled, getGCStats, GCStats(..))
69import GHC.Stats (getGCStatsEnabled, getGCStats, GCStats(..))
72+-- | Enable (or disable) JSaddle logging
73+enableLogging :: Bool -> JSM ()
75+enableLogging _ = return ()
78+ f <- doEnableLogging <$> JSM ask
71-- | Forces execution of pending asyncronous code
82-- | Forces execution of pending asyncronous code
72syncPoint :: JSM ()
83syncPoint :: JSM ()
73#ifdef ghcjs_HOST_OS
84#ifdef ghcjs_HOST_OS
@@ -156,7 +167,7 @@ runJavaScript sendBatch entryPoint = do
156 , addCallback = \(Object (JSVal val)) cb -> atomically $ modifyTVar' callbacks (M.insert val cb)
167 , addCallback = \(Object (JSVal val)) cb -> atomically $ modifyTVar' callbacks (M.insert val cb)
157 , freeCallback = \(Object (JSVal val)) -> atomically $ modifyTVar' callbacks (M.delete val)
168 , freeCallback = \(Object (JSVal val)) -> atomically $ modifyTVar' callbacks (M.delete val)
158 , nextRef = nextRef'
169 , nextRef = nextRef'
159− , enableLogging = atomicWriteIORef loggingEnabled
170+ , doEnableLogging = atomicWriteIORef loggingEnabled
161 let processResults = \case
172 let processResults = \case
162 (ProtocolError err) -> error $ "Protocol error : " <> T.unpack err
173 (ProtocolError err) -> error $ "Protocol error : " <> T.unpack err