0
Fork 0
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:
Andrey Antukh 2019-08-07 20:13:43 +02:00
parent fada526f5d
commit fcc7351552
2 changed files with 6 additions and 2 deletions

View file

@ -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))))

View file

@ -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))