Log closed sidebar event in content script

This commit is contained in:
Jeremy Dormitzer 2018-02-01 09:47:40 -07:00
parent 242d991b0c
commit 344e8734c1
No known key found for this signature in database
GPG Key ID: 04F17C0F5A32C320
2 changed files with 3 additions and 4 deletions

View File

@ -2,6 +2,7 @@
(:require [goog.dom :as dom]
[goog.events :as events]
[goog.style :as style]
[looped-in.analytics :as analytics]
[looped-in.logging :as log]))
(def sidebar-width 300)
@ -34,6 +35,7 @@
(defn close-sidebar []
(let [$html (.-documentElement js/document)
$sidebar (dom/getElement "loopedInSidebar")]
(analytics/log-event "CLOSED_SIDEBAR")
(dom/removeNode $sidebar)
(set! (-> $html (.-style) (.-paddingLeft)) @old-html-padding)))

View File

@ -224,10 +224,7 @@
(dom/append $container $sidebar-dom))))
(defn handle-close-button [e]
(go (-> (analytics/log-event "CLOSED_SIDEBAR")
(<!)
((fn [_]
(.postMessage js/window.parent (clj->js {:type "closeSidebar"}) "*"))))))
(.postMessage js/window.parent (clj->js {:type "closeSidebar"}) "*"))
(defn handle-events
"Registers event listeners"