0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 00:10:11 -05:00

🐛 Fix many warnings.

This commit is contained in:
Andrey Antukh 2020-08-05 15:17:22 +02:00
parent 9b4cc30d3f
commit 313723cfe1
4 changed files with 26 additions and 26 deletions

View file

@ -69,8 +69,8 @@
(fn [event]
(when (kbd/ctrl? event)
(dom/prevent-default event)
(let [event (.getBrowserEvent event)]
(if (pos? (.-deltaY event))
(let [event (.getBrowserEvent ^js event)]
(if (pos? (.-deltaY ^js event))
(st/emit! dv/decrease-zoom)
(st/emit! dv/increase-zoom)))))

View file

@ -254,8 +254,8 @@
on-key-down
(mf/use-callback
(fn [event]
(let [bevent (.getBrowserEvent event)
key (.-keyCode event)
(let [bevent (.getBrowserEvent ^js event)
key (.-keyCode ^js event)
ctrl? (kbd/ctrl? event)
shift? (kbd/shift? event)
alt? (kbd/alt? event)
@ -295,11 +295,11 @@
on-mouse-move
(fn [event]
(let [event (.getBrowserEvent event)
pt (dom/get-client-position event)
(let [event (.getBrowserEvent ^js event)
pt (dom/get-client-position ^js event)
pt (translate-point-to-viewport pt)
delta (gpt/point (.-movementX event)
(.-movementY event))]
delta (gpt/point (.-movementX ^js event)
(.-movementY ^js event))]
(st/emit! (ms/->PointerEvent :delta delta
(kbd/ctrl? event)
(kbd/shift? event)
@ -316,7 +316,7 @@
target (dom/get-target event)]
(cond
(kbd/ctrl? event)
(let [event (.getBrowserEvent event)
(let [event (.getBrowserEvent ^js event)
pos @ms/mouse-position]
(dom/prevent-default event)
(dom/stop-propagation event)
@ -325,7 +325,7 @@
(st/emit! (dw/increase-zoom pos))))
(.contains ^js node target)
(let [event (.getBrowserEvent event)
(let [event (.getBrowserEvent ^js event)
delta (.-deltaY ^js event)
delta (/ delta @refs/selected-zoom)]
(dom/prevent-default event)

View file

@ -53,8 +53,8 @@
qdt (.createFromMap QueryData (-> qparams
(d/remove-nil-vals)
(clj->js)))]
(.setQueryData uri qdt)
(.toString uri))))))
(.setQueryData ^js uri qdt)
(.toString ^js uri))))))
(defn create
[routes]
@ -70,7 +70,7 @@
(defn query-params
"Given goog.Uri, read query parameters into Clojure map."
[^goog.Uri uri]
(let [q (.getQueryData uri)]
(let [^js q (.getQueryData uri)]
(->> q
(.getKeys)
(map (juxt keyword #(.get q %)))
@ -80,9 +80,9 @@
"Given routing tree and current path, return match with possibly
coerced parameters. Return nil if no match found."
[router path]
(let [uri (.parse Uri path)]
(when-let [match (r/match-by-path router (.getPath uri))]
(let [qparams (parse-query-data (.getQueryData uri))
(let [uri (.parse ^js Uri path)]
(when-let [match (r/match-by-path router (.getPath ^js uri))]
(let [qparams (parse-query-data (.getQueryData ^js uri))
params {:path (:path-params match) :query qparams}]
(assoc match
:params params
@ -128,9 +128,9 @@
(let [stoper (rx/filter (ptk/type? ::initialize-history) stream)
history (:history state)
router (:router state)]
(ts/schedule #(on-change router (.getToken history)))
(ts/schedule #(on-change router (.getToken ^js history)))
(->> (rx/create (fn [sink]
(let [key (e/listen history "navigate" #(sink (.-token %)))]
(let [key (e/listen history "navigate" (fn [o] (sink (.-token ^js o))))]
(fn []
(bhistory/disable! history)
(e/unlistenByKey key)))))

View file

@ -27,13 +27,13 @@
(defn uri
([path] (uri path {}))
([path params]
(let [uri (.parse Uri cfg/public-uri)]
(.setPath uri path)
(if (= (.getScheme uri) "http")
(.setScheme uri "ws")
(.setScheme uri "wss"))
(let [uri (.parse ^js Uri cfg/public-uri)]
(.setPath ^js uri path)
(if (= (.getScheme ^js uri) "http")
(.setScheme ^js uri "ws")
(.setScheme ^js uri "wss"))
(run! (fn [[k v]]
(.setParameterValue uri (name k) (str v)))
(.setParameterValue ^js uri (name k) (str v)))
params)
(.toString uri))))
@ -55,8 +55,8 @@
IWebSocket
(-stream [_] sb)
(-send [_ msg]
(when (.isOpen ws)
(.send ws msg)))
(when (.isOpen ^js ws)
(.send ^js ws msg)))
(-close [_]
(.close ws)
(rx/end! sb)