Browse files

Generate server string from window.location.

  • Loading branch information...
1 parent 2c73b9a commit 1f5a143b75215c5a48f676ccd15ce3c1ddbe1f6a @brentonashworth brentonashworth committed Dec 15, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/app/cljs/one/sample/core.cljs
View
10 src/app/cljs/one/sample/core.cljs
@@ -1,14 +1,16 @@
(ns ^{:doc "Contains the entry point for the ClojureScript sample application."}
one.sample.core
- (:require [clojure.browser.repl :as repl]
+ (:require [goog.uri.utils :as uri]
+ [clojure.browser.repl :as repl]
[one.dispatch :as dispatch]
[one.sample.view :as view]))
;; TODO: Add marginalia comment to explain what :export is for.
-(defn- domain
+(defn- server
[]
- (uri/getDomain (.toString window.location ())))
+ (let [location (.toString window.location ())]
+ (str (uri/getScheme location) "://" (uri/getDomain location))))
(defn ^:export repl
"Connects to a ClojureScript REPL running on localhost port 9000.
@@ -17,7 +19,7 @@
browser for evaluation. This function should be called from a script
in the development host HTML page."
[]
- (repl/connect (str "http://" (domain) ":9000/repl")))
+ (repl/connect (str (server) ":9000/repl")))
(defn ^:export start
"Start the application by firing a :form event which will cause the

0 comments on commit 1f5a143

Please sign in to comment.