title | description | author | created | updated | ||
---|---|---|---|---|---|---|
{{title}} |
{{description}} |
{{author}} |
|
|
Chaining promises in ClojureScript is best done using the thread-first macro, ->
. Here's an example of using the fetch API:
(-> (js/fetch "/data")
(.then (fn [r]
(when-not (.-ok r)
(throw (js/Error. "Could not fetch /data")))
(.json r)))
This file contains hidden or 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
(:require [re-frame.core :as re-frame] | |
[reagent.core :as reagent] | |
[cljsjs.chartjs]) | |
(defn show-revenue-chart | |
[] | |
(let [context (.getContext (.getElementById js/document "rev-chartjs") "2d") | |
chart-data {:type "bar" | |
:data {:labels ["2012" "2013" "2014" "2015" "2016"] | |
:datasets [{:data [5 10 15 20 25] |
This file contains hidden or 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
# | |
# CORS header support | |
# | |
# One way to use this is by placing it into a file called "cors_support" | |
# under your Nginx configuration directory and placing the following | |
# statement inside your **location** block(s): | |
# | |
# include cors_support; | |
# | |
# As of Nginx 1.7.5, add_header supports an "always" parameter which |