Created
November 21, 2015 01:18
-
-
Save chadhs/a8a5f06c668f54e6611d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Natal Demo | |
## getting started | |
install natal | |
```sh | |
npm install -g natal | |
``` | |
create an example app | |
```sh | |
natal init FutureApp --interface om-next | |
``` | |
now you can start playing interactively | |
```sh | |
cd future-app | |
natal repl | |
``` | |
test making a change live | |
```clojure | |
(in-ns 'future-app.core) | |
(swap! app-state assoc :text "Hello Native World") | |
``` | |
## rocking some emacs | |
open emacs and navigate to your project folder | |
open your project.clj and add the following | |
```clojure | |
:profiles {:dev {:dependencies [[com.cemerick/piggieback "0.2.1"] | |
[org.clojure/tools.nrepl "0.2.10"]] | |
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}} | |
``` | |
now use cider jack in to launch a repl | |
connect to your repl and enter the following code | |
```clojure | |
(require | |
'[cljs.repl :as repl] | |
'[cemerick.piggieback] | |
'[ambly.core :as ambly]) | |
(cemerick.piggieback/cljs-repl | |
(ambly/repl-env :choose-first-discovered true)) | |
``` | |
test making a change live in the cider repl | |
```clojure | |
(in-ns 'future-app.core) | |
(swap! app-state assoc :text "Hello Clojure MKE") | |
``` | |
open core.cljs | |
test making a persistent change to `:onPress #(alert` in this file and then save and eval the buffer | |
```clojure | |
(touchable-highlight | |
{:style {:backgroundColor "#999" :padding 10 :borderRadius 5} | |
:onPress #(alert "i'm hackin it live yo")} | |
(text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me")) | |
``` | |
now press the button to see the change! | |
## result | |
<https://www.dropbox.com/s/n7o8yasr9nnubcr/Screenshot%202015-11-20%2018.35.06.png?dl=0> | |
## resources: | |
- <https://github.com/dmotz/natal> | |
- <https://github.com/cemerick/piggieback#installation> | |
- <https://github.com/dmotz/natal/issues/5> | |
- <https://github.com/omcljs/om/wiki/Quick-Start-(om.next)> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment