Skip to content

Instantly share code, notes, and snippets.

@LispyAriaro
Forked from cap10morgan/async_geolocation.cljs
Last active August 29, 2015 14:15
Show Gist options
  • Save LispyAriaro/4817baadc30b71ca0c23 to your computer and use it in GitHub Desktop.
Save LispyAriaro/4817baadc30b71ca0c23 to your computer and use it in GitHub Desktop.
(ns cljs-minimal.core
(:require [cljs.core.async :as async :refer [put! <! >! <!! >!! chan]])
(:require-macros [cljs.core.async.macros :as m :refer [go]]))
(defn get-position []
(let [out (chan)
geo (.-geolocation js/navigator)]
(.getCurrentPosition geo (fn [pos] (put! out pos)))
out))
(go
(let [coords (.-coords (<! (get-position)))
latitude (.-latitude coords)
longitude (.-longitude coords)]
(.log js/console "Lat:" latitude "Long:" longitude)))
(.log js/console "After the go block")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment