This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-28
Channels
- # announcements (1)
- # babashka (28)
- # beginners (228)
- # cider (9)
- # clara (6)
- # clojure (66)
- # clojure-uk (13)
- # clojuredesign-podcast (5)
- # clojurescript (9)
- # core-typed (1)
- # cursive (1)
- # duct (2)
- # emacs (8)
- # fulcro (18)
- # graalvm (11)
- # hyperfiddle (1)
- # malli (2)
- # off-topic (33)
- # re-frame (9)
- # reagent (3)
- # reitit (15)
- # shadow-cljs (6)
- # tools-deps (1)
(require '[cljs.build.api :as b])
(b/build "src"
{:output-dir "out"
:output-to "out/main.js"
:target :nodejs
:optimizations :simple
:main 'cljs-fstore.core
:install-deps true
:npm-deps {:@google-cloud/firestore "3.1.0"}})
I wish to use this package in the build script. @google-cloud/firestore
This throws an error. How to make npm realise this package?
How can I remove the following warning?
(defn- recordStartTime
[]
(this-as this
(aset this "_startAt" (js/process.hrtime))))
Ok. I can just include @constructor doc to a function 🙂
could anybody point me to the best way to translate this to cljs? https://github.com/WebDevSimplified/Face-Detection-JavaScript/blob/bfa78b9795aec7d2751fba73b279343438ca2d34/script.js#L23
this is what I ended up with, was just wondering if there's a better way
(js/setInterval
(fn []
(let [promise
(js/Promise.
(fn detect []
(-> (face-api/detectAllFaces video (face-api/TinyFaceDetectorOptions.))
(.withFaceLandmarks)
(.withFaceExpressions)
(.then
(fn [detections]
(let [resized-detections (face-api/resizeResults detections (clj->js display-size))]
(.clearRect (.getContext canvas "2d") 0 0 (:width display-size) (:height display-size))
(-> face-api/draw (.drawDetections canvas resized-detections))
(-> face-api/draw (.drawFaceLandmarks canvas resized-detections))
(-> face-api/draw (.drawFaceExpressions canvas resized-detections))))))))]
(set! (.-resolve promise) true)))
100)
Maybe I’m missing something, but I think you should be able to loose the outer promise.
(js/setInterval
(fn detect []
(-> (face-api/detectAllFaces video (face-api/TinyFaceDetectorOptions.))
(.withFaceLandmarks)
(.withFaceExpressions)
(.then
(fn [detections]
(let [resized-detections (face-api/resizeResults detections (clj->js display-size))]
(.clearRect (.getContext canvas "2d") 0 0 (:width display-size) (:height display-size))
(-> face-api/draw (.drawDetections canvas resized-detections))
(-> face-api/draw (.drawFaceLandmarks canvas resized-detections))
(-> face-api/draw (.drawFaceExpressions canvas resized-detections)))))))
100)