Log closed event from background.cljs instead of content.cljs
This commit is contained in:
parent
0ea66897d4
commit
bb99c1a33d
@ -3,6 +3,7 @@
|
|||||||
[ajax.core :refer [GET]]
|
[ajax.core :refer [GET]]
|
||||||
[goog.string :as gstring]
|
[goog.string :as gstring]
|
||||||
[looped-in.hackernews :as hn]
|
[looped-in.hackernews :as hn]
|
||||||
|
[looped-in.analytics :as analytics]
|
||||||
[looped-in.logging :as log]
|
[looped-in.logging :as log]
|
||||||
[looped-in.promises :refer [channel->promise promise->channel]]))
|
[looped-in.promises :refer [channel->promise promise->channel]]))
|
||||||
|
|
||||||
@ -85,7 +86,8 @@
|
|||||||
"hits" (channel->promise (go @hits))
|
"hits" (channel->promise (go @hits))
|
||||||
"fetchItem" (channel->promise
|
"fetchItem" (channel->promise
|
||||||
(go (clj->js (<! (hn/fetch-item (.-id msg))))))
|
(go (clj->js (<! (hn/fetch-item (.-id msg))))))
|
||||||
"getUserId" (channel->promise (get-user-id))))
|
"getUserId" (channel->promise (get-user-id))
|
||||||
|
"logEvent" (analytics/log-event (.-eventType msg) (.-eventProperties msg))))
|
||||||
|
|
||||||
(-> js/browser
|
(-> js/browser
|
||||||
(.-tabs)
|
(.-tabs)
|
||||||
@ -107,3 +109,4 @@
|
|||||||
(.-onMessage)
|
(.-onMessage)
|
||||||
(.addListener handle-message))
|
(.addListener handle-message))
|
||||||
|
|
||||||
|
(analytics/init-amplitude)
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
(defn close-sidebar []
|
(defn close-sidebar []
|
||||||
(let [$html (.-documentElement js/document)
|
(let [$html (.-documentElement js/document)
|
||||||
$sidebar (dom/getElement "loopedInSidebar")]
|
$sidebar (dom/getElement "loopedInSidebar")]
|
||||||
(analytics/log-event "CLOSED_SIDEBAR")
|
(-> js/browser (.-runtime) (.sendMessage (clj->js {:type "logEvent"
|
||||||
|
:eventType "CLOSED_SIDEBAR"})))
|
||||||
(dom/removeNode $sidebar)
|
(dom/removeNode $sidebar)
|
||||||
(set! (-> $html (.-style) (.-paddingLeft)) @old-html-padding)))
|
(set! (-> $html (.-style) (.-paddingLeft)) @old-html-padding)))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user