Skip to content

Commit

Permalink
browserid.org appears to be calling our callback function.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbauman committed May 6, 2012
1 parent b190256 commit 19e8f49
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions resources/public/deps.js
@@ -0,0 +1 @@
// google closure wants this file for some reason...
14 changes: 9 additions & 5 deletions src-cljs/nongrata/main.cljs
Expand Up @@ -8,10 +8,14 @@
(defn log-obj [obj]
(.log js/console obj))

; Using jayq, do this with jquery...
; $("#signin-img").bind('click', function() { alert("button clicked!"); });
(.bind ($ "#signin-img") "click" (fn[] (js/alert "button clicked!")))
(defn gotAssertion
[assertion]
(js/alert (str "callback invoked: " assertion)))

; If we got here, everything should be good
(js/alert "JS Code compiled and running 5...")
(.bind ($ "#browserid") "click" (fn[evt] (js/alert (str "button clicked! event: " evt))
(do
navigator.id/get(gotAssertion)
false)))

(js/alert "JS evaluation reached bottom of the main.js file...")

4 changes: 2 additions & 2 deletions src/nongrata/views/welcome.clj
Expand Up @@ -9,6 +9,6 @@
(common/layout
[:p
(if (not (session/get "browser-id"))
[:a {"href" "#" "id" "browserid" "title" "Sign-in with BrowserID"}
[:img {"id" "signin-img" "src" "/img/sign_in_blue.png" "alt" "Sign in"}]]
[:a#browserid-link {"href" "#" "title" "Sign-in with BrowserID"}
[:img#browserid {"src" "/img/sign_in_blue.png" "alt" "Sign in"}]]
"You are signed in!")]))

0 comments on commit 19e8f49

Please sign in to comment.