Skip to content

Commit

Permalink
fixed bug with clicking window.open
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Zaporzan authored and Benjamin Zaporzan committed Oct 1, 2014
1 parent 9e64e08 commit f99752c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject flyer "1.0.1"
(defproject flyer "1.0.2"
:description "Clojurescript + Javascript Broadcast Messaging between
iFrames, Framesets, and Windows"
:url "https://github.com/benzap/flyer.js"
Expand Down
4 changes: 4 additions & 0 deletions src-cljs/flyer/storage.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
(defn get-window-refs []
(aget storage window-list-key))

(defn has-window-ref? [window]
(let [winref (get-window-refs)]
(some #{window} winref)))

(defn insert-window-ref! [window]
(aset storage window-list-key
(conj (get-window-refs) window)))
Expand Down
5 changes: 4 additions & 1 deletion src-cljs/flyer/window.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ external windows that are opened using the 'open' function"
:else
(apply gen-window-options options))
window (.open this-window url name options-str)]
(storage/insert-window-ref! window)
;;only add the window to our window references if it didn't exist previously
;;fixes issue with IE when trying to re-open a window
(when (not (storage/has-window-ref? window))
(storage/insert-window-ref! window))
(events/listen
window (.-BEFOREUNLOAD events/EventType)
(fn [event]
Expand Down

0 comments on commit f99752c

Please sign in to comment.