Skip to content

Commit

Permalink
amend
Browse files Browse the repository at this point in the history
  • Loading branch information
massudaw committed Aug 28, 2017
1 parent 29f23aa commit 9f79612
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
7 changes: 2 additions & 5 deletions src/Foreign/JavaScript.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ module Foreign.JavaScript (
) where

import Control.Concurrent.STM as STM
import Control.Monad (unless,when)
import Control.Monad (unless)
import qualified Data.Aeson as JSON
import Foreign.JavaScript.CallBuffer
import Foreign.JavaScript.EventLoop
import Foreign.JavaScript.Marshal
import Foreign.JavaScript.Server
import Foreign.JavaScript.Types
import Foreign.RemotePtr as Foreign
import Data.Time
import Data.Maybe(isJust)

{-----------------------------------------------------------------------------
Server
Expand All @@ -66,8 +64,7 @@ serve config init = httpComm config $ eventLoop $ \w -> do
-- it can be buffered and sent to the browser window at a later time.
-- See 'setCallBufferMode' and 'flushCallBuffer' for more.
runFunction :: Window -> JSFunction () -> IO ()
runFunction w f = do
bufferRunEval w =<< toCode f
runFunction w f = bufferRunEval w =<< toCode f

-- | Run a JavaScript function that creates a new object.
-- Return a corresponding 'JSObject' without waiting for the browser
Expand Down
15 changes: 0 additions & 15 deletions src/Foreign/JavaScript/EventLoop.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ eventLoop init server comm = void $ do
-- The thread `multiplexer` reads from the client and
-- sorts the messages into the appropriate queue.
events <- newTQueueIO
lastwrite <- newTVarIO Nothing
results <- newTQueueIO :: IO (TQueue Result)
-- The thread `handleCalls` executes FFI calls
-- from the Haskell side in order.
Expand Down Expand Up @@ -125,21 +124,7 @@ eventLoop init server comm = void $ do
result <- readTQueue results
putTMVar ref result
Nothing -> return ()
<<<<<<< HEAD
||||||| parent of 742e75f... mend
let flushTimeout = forever (do
v <- flushDirtyBuffer comm w
case v of
Left i -> threadDelay (i *1000)
Right (i,code') -> do
runEval w $ code' []
threadDelay (i *1000)
)


=======

>>>>>>> 742e75f... mend
-- Receive events from client and handle them in order.
let handleEvents = do
me <- atomically $ do
Expand Down
1 change: 0 additions & 1 deletion src/Foreign/JavaScript/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ data Config = Config
-- @Nothing@ means that the port number is
-- read from the environment variable @PORT@.
-- Alternatively, port @8023@ is used if this variable is not set.
>>>>>>> a2dff44... force flush of buffer
, jsAddr :: Maybe ByteString
, jsCustomHTML :: Maybe FilePath
, jsStatic :: Maybe FilePath
Expand Down

0 comments on commit 9f79612

Please sign in to comment.