Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jsaddle-warp/src/Language/Javascript/JSaddle/WebSockets.hs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ jsaddleJs' jsaddleUri refreshOnLoad = "\
" return;\n\
\ }\n\
\\n\
\var initialSyncDepth = 0;\n\
\ " <> runBatch (\a -> "ws.send(JSON.stringify(" <> a <> "));")
(Just (\a -> "(function(){\n\
\ var xhr = new XMLHttpRequest();\n\
Expand Down
6 changes: 4 additions & 2 deletions jsaddle/src/Language/Javascript/JSaddle/Run/Files.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ initState = "\

runBatch :: (ByteString -> ByteString) -> Maybe (ByteString -> ByteString) -> ByteString
runBatch send sendSync = "\
\ var runBatch = function(firstBatch, initialSyncDepth) {\n\
\ var runBatch = function(firstBatch) {\n\
\ var processBatch = function(timestamp) {\n\
\ var batch = firstBatch;\n\
\ var callbacksToFree = [];\n\
Expand Down Expand Up @@ -153,7 +153,8 @@ runBatch send sendSync = "\
" if(inCallback > 0) {\n\
\ " <> send "{\"tag\": \"Callback\", \"contents\": [lastResults[0], lastResults[1], nFunction, nFunctionInFunc, nThis, args]}" <> "\n\
\ } else {\n\
\ runBatch(" <> s "{\"tag\": \"Callback\", \"contents\": [lastResults[0], lastResults[1], nFunction, nFunctionInFunc, nThis, args]}" <> ", 1);\n\
\ initialSyncDepth = 1;\n\
\ runBatch(" <> s "{\"tag\": \"Callback\", \"contents\": [lastResults[0], lastResults[1], nFunction, nFunctionInFunc, nThis, args]}" <> ");\n\
\ }\n"
Nothing ->
" " <> send "{\"tag\": \"Callback\", \"contents\": [lastResults[0], lastResults[1], nFunction, nFunctionInFunc, nThis, args]}" <> "\n"
Expand Down Expand Up @@ -336,6 +337,7 @@ runBatch send sendSync = "\
\ processBatch(globalThis.performance ? globalThis.performance.now() : null);\n\
\ }\n\
\ };\n\
\ initialSyncDepth = 0;\n\
\ runBatch(batch);\n\
\"

Expand Down