🎉 Add worker base implementation.

This commit is contained in:
Andrey Antukh 2020-04-16 13:49:59 +02:00 committed by Alonso Torres
parent 517b50238e
commit 484702527e
13 changed files with 86 additions and 79 deletions

View file

@ -17,14 +17,6 @@
[message]
(println "Unexpected message:" message))
;; --- Helpers
(defn worker?
"Check if the code is executed in webworker context."
[]
(undefined? (.-document js/self)))
(defn reply!
[sender message]
(let [message (assoc message :reply-to sender)]
(.postMessage js/self (t/encode message))))
(defmethod handler :echo
[message]
message)