-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
awb99
committed
Apr 22, 2024
1 parent
06492b7
commit 8983852
Showing
19 changed files
with
163 additions
and
28 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(ns demo.page.scipage | ||
(:require | ||
[demo.cljs-libs.helper :refer [wrap-layout]])) | ||
|
||
|
||
(defn sci-page1 [_r] | ||
[:div | ||
[:p "I am interpreted by sci"] | ||
[:p "1 + 2 = " (+ 1 2)] | ||
]) | ||
|
||
(def sci-page | ||
(wrap-layout sci-page1)) |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{:paths ["src" | ||
"resources" ; extension | ||
] | ||
:deps {org.pinkgorilla/reval {:mvn/version "0.6.151"}} | ||
:deps {org.pinkgorilla/reval {:mvn/version "0.6.156"}} | ||
; | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(ns demo.notebook.ajax | ||
(:require | ||
[clojure.edn :as edn] | ||
[promesa.core :as p] | ||
[ajax.promise :refer [GET]])) | ||
|
||
(defn json-get [url] | ||
(p/let [resp (js/fetch url) | ||
json (.json resp)] | ||
(js->clj json :keywordize-keys true))) | ||
|
||
(defn edn-get [url] | ||
(p/let [resp (GET url) | ||
edn (edn/read-string resp)] | ||
edn)) | ||
|
||
(json-get "/r/repl/bongo.json") | ||
|
||
(edn-get "/r/repl/bongo.edn") | ||
|
||
(def r (edn-get "/r/repl/bongo.edn")) | ||
|
||
(type r) | ||
(p/promise? r) | ||
|
||
; not in sci-configs - ticket made. | ||
(p/pending? r) | ||
(p/resolved? r) | ||
(p/done? r) | ||
(p/extract r) | ||
(deref r) | ||
(println @r) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(ns demo.notebook.clojure-edn | ||
(:require | ||
[clojure.edn :as edn])) | ||
|
||
(def x (pr-str {:a 1 :b true :name "harry potter"})) | ||
|
||
(edn/read-string x) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{:name "cljs-ajax" | ||
; build | ||
:lazy false | ||
:cljs-namespace [ajax.core | ||
ajax.promise] | ||
:cljs-ns-bindings {'ajax.core {'GET ajax.core/GET | ||
'POST ajax.core/POST | ||
'PUT ajax.core/PUT | ||
'DELETE ajax.core/DELETE | ||
; request/response formats | ||
'json-request-format ajax.core/json-request-format | ||
'json-response-format ajax.core/json-response-format | ||
'transit-request-format ajax.core/transit-request-format | ||
'transit-response-format ajax.core/transit-response-format | ||
'ring-response-format ajax.core/ring-response-format | ||
'url-request-format ajax.core/url-request-format | ||
'text-request-format ajax.core/text-request-format | ||
'text-response-format ajax.core/text-response-format | ||
; There's no raw-request-format because it's handled by the DirectSubmission code | ||
'raw-response-format ajax.core/raw-response-format} | ||
'ajax.promise {'GET ajax.promise/GET | ||
'POST ajax.promise/POST | ||
'PUT ajax.promise/PUT | ||
'DELETE ajax.promise/DELETE} | ||
|
||
}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{:name "clojure.edn" | ||
; build | ||
:lazy false | ||
:cljs-namespace [clojure.edn] | ||
:cljs-ns-bindings {'clojure.edn {'read-string clojure.edn/read-string | ||
'read clojure.edn/read}}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{:bongo "trott" | ||
:a 1} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"name":"John", | ||
"age":30, | ||
"city":"New York"} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
the grass is greener on the other side! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(ns ajax.promise | ||
(:require | ||
[promesa.core :as p] | ||
[ajax.core :as ajax])) | ||
|
||
(defn wrap-promise | ||
[AJAX-TYPE url params] | ||
(p/create | ||
(fn [resolve reject] | ||
(AJAX-TYPE url | ||
(merge params | ||
{:handler (fn [response] | ||
(resolve response)) | ||
:error-handler (fn [error] | ||
(reject error))}))))) | ||
|
||
(defn GET | ||
([url] (GET url {})) | ||
([url params] (wrap-promise ajax/GET url params))) | ||
|
||
(defn POST | ||
([url] (POST url {})) | ||
([url params] (wrap-promise ajax/POST url params))) | ||
|
||
(defn PUT | ||
([url] (PUT url {})) | ||
([url params] (wrap-promise ajax/PUT url params))) | ||
|
||
(defn DELETE | ||
([url] (DELETE url {})) | ||
([url params] (wrap-promise ajax/DELETE url params))) |
File renamed without changes.