suprematic / ascent.repl

ClojureScript REPL for Chrome DevTools
39 stars 1 forks source link

Add readme to this repo and include links to existing documentation #4

Open DinisCruz opened 9 years ago

DinisCruz commented 9 years ago

like for example http://blog.suprematic.net/2014/03/new-version-of-chrome-devtools-repl-151.html and http://blog.suprematic.net/2014/02/chrome-devtools-repl-for-clojurescript_26.html

aeberts commented 9 years ago

+1 for this request for basic usage instructions.

Specifically I'd like to see newbie instructions for connecting your ClojureScript console to the application that's running in the browser window (if that's indeed possible with this extension). Normally I would start a browser repl by doing the following:

(code is from the very informative: http://www.niwi.be/cljs-workshop/)

in your main cljs file:

(ns cljsworkshop.core
  (:require [...]
            [clojure.browser.repl :as repl]))

(repl/connect "http://localhost:9000/repl")

Create a repl setup file: repl_browser.clj

(require
  '[cljs.repl :as repl]
  '[cljs.repl.browser :as browser])

(repl/repl* (browser/repl-env)
  {:output-dir "out"
   :optimizations :none
   :cache-analysis false
   :source-map true})

Start the repl with

lein trampoline run -m clojure.main repl_browser.clj

Evaluate ClojureScript expressions:

cljs.user=> (in-ns 'cljsworkshop.core)
cljsworkshop.core
cljsworkshop.core=> @tasklist-state
{:entries [{:completed false, :created-at "2014-12-08T11:32:10.677Z", :subject "task 1"}]}
nil

I'm assuming I would be able to do something similar in the ClojureScript console but I get the following error:

> (in-ns 'cljsworkshop.core)
TypeError: Cannot read property 'call' of undefined

Apologies if this is a basic newbie question but I'm assuming this may be a common stumbling block.

simax commented 9 years ago

I agree entirely basic usage instructions would be extremely useful. The first thing I tried was to load a current app I'm working on and try to switch to a namespace. e.g.

(in-ns 'my-namespace.core)

But of course, I got the same error TypeError: Cannot read property 'call' of undefined . Documentation here would be really appreciated.