Skip to content

Commit

Permalink
security #7
Browse files Browse the repository at this point in the history
  • Loading branch information
flexsurfer committed Sep 4, 2019
1 parent df66b73 commit c6d525b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/status_im/ui/screens/browser/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
[status-im.utils.slurp :refer [slurp]]
[status-im.utils.views :as views]))

(def timeout (atom {}))

(defn debounce [event]
(when @timeout (js/clearTimeout @timeout))
(reset! timeout (js/setTimeout #(re-frame/dispatch event) 500)))

(def browser-config-edn
(slurp "./src/status_im/utils/browser_config.edn"))

Expand Down Expand Up @@ -59,6 +65,7 @@
{:browser? true}
[toolbar.view/nav-button
(actions/close (fn []
(when @timeout (js/clearTimeout @timeout))
(re-frame/dispatch [:navigate-back])
(when error?
(re-frame/dispatch [:browser.ui/remove-browser-pressed browser-id]))))]
Expand Down Expand Up @@ -130,7 +137,7 @@
:bounces false
:local-storage-enabled true
:render-error web-view-error
:on-navigation-state-change #(re-frame/dispatch [:browser/navigation-state-changed % error?])
:on-navigation-state-change #(debounce [:browser/navigation-state-changed % error?])
:on-bridge-message #(re-frame/dispatch [:browser/bridge-message-received %])
:on-load #(re-frame/dispatch [:browser/loading-started])
:on-error #(re-frame/dispatch [:browser/error-occured])
Expand Down

0 comments on commit c6d525b

Please sign in to comment.