mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 02:28:18 -05:00
🔊 Add some logging to worker modules.
This commit is contained in:
parent
fada526f5d
commit
fcc7351552
2 changed files with 6 additions and 2 deletions
|
@ -25,13 +25,11 @@
|
|||
|
||||
;; This excludes webworker instantiation on nodejs where
|
||||
;; the tests are run.
|
||||
|
||||
(when (not= *target* "nodejs")
|
||||
(defonce worker (uw/init "/js/worker.js")))
|
||||
|
||||
(defn align-point
|
||||
[point]
|
||||
|
||||
(let [message {:cmd :grid-align :point point}]
|
||||
(->> (uw/ask! worker message)
|
||||
(rx/map :point))))
|
||||
|
|
|
@ -6,12 +6,16 @@
|
|||
|
||||
(ns uxbox.worker
|
||||
(:require [beicon.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[uxbox.util.transit :as t]
|
||||
[uxbox.util.uuid :as uuid]
|
||||
[uxbox.worker.impl :as impl]
|
||||
[uxbox.worker.align]))
|
||||
|
||||
(enable-console-print!)
|
||||
|
||||
(defonce id (uuid/random))
|
||||
|
||||
(defn- on-message
|
||||
[event]
|
||||
(let [message (t/decode (.-data event))]
|
||||
|
@ -19,3 +23,5 @@
|
|||
|
||||
(defonce _
|
||||
(.addEventListener js/self "message" on-message))
|
||||
|
||||
(println (str/format "Worker with id '%s' is initialized." id))
|
||||
|
|
Loading…
Add table
Reference in a new issue