This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-20
Channels
- # beginners (43)
- # boot (44)
- # chestnut (17)
- # cider (78)
- # cljs-dev (24)
- # cljsrn (16)
- # clojure (84)
- # clojure-dusseldorf (1)
- # clojure-italy (21)
- # clojure-losangeles (2)
- # clojure-russia (140)
- # clojure-sg (2)
- # clojure-spec (8)
- # clojure-uk (16)
- # clojurescript (23)
- # cursive (7)
- # datascript (1)
- # datomic (18)
- # docker (20)
- # ethereum (1)
- # fulcro (16)
- # garden (4)
- # graphql (27)
- # hoplon (9)
- # jobs (4)
- # luminus (34)
- # off-topic (6)
- # om (4)
- # onyx (35)
- # pedestal (3)
- # re-frame (24)
- # ring-swagger (15)
- # rum (6)
- # shadow-cljs (22)
- # spacemacs (8)
- # specter (22)
- # yada (7)
Hello friends, I have to build a Lumo
script @work (something that I never did) and I have a few questions for those who have answers :
1. Is there a “clojure” way to use promise/async/await (I am using puppeteer
with headless chrome
2. Do you have some feedbacks on running nodejs generated with cljs script in Lambda ?
Hello ! Did you tried Promessa ? http://funcool.github.io/promesa/latest/
@baptiste-from-paris there is core.async for cljs, you can have go loops with a wait and some conditions
you mean wrapping wait/async
calls into core.async ?
@baptiste-from-paris there's no cljs syntax for async/wait, I think there's a neat hack that was come up with in #lumo
(defn x [] (js/Promise. (fn [resolve reject] (resolve 42))))
(js* "(async () => ~{}(await ~{}))();" js/console.log (x))
(Note, this uses internals of cljs)
This could be wrapped into an async
macro 🙂ok, thx a lot @dominicm
How can I access process.env variables from a cljs app running on node.js?
(ns app.core
(:require [cljs.nodejs :as nodejs]))
(nodejs/enable-util-print!)
(defn -main [& _]
(println "your var: " (aget js/process.env "MYVAR") ))
(set! *main-cli-fn* -main)
then (core.js is figwheel compiled app:)
node app/core.js MYVAR=foo
Prints:
Your var: nil
and the process.env is a JSON object? Can I js/JSON.parse it and access all the keys?
@fbielejec no, it is just a JS object, AFAIK
@fbielejec If you want all the keys, (js-keys js/process.env)
@fbielejec You can do (source js-keys)
at a REPL to see how it works. FWIW, there is a ticket (CLJS-2340) that may result in js-keys
simply delegating to goog.object/getKeys
This might be a beginner question, but I have a large json data file that want to have access to as a clojure map for a static site I’m developing (no backend, just cljs), can I just use :require?
I figure I’ll use either transit/read, edn/read or just JSON/parse, but curious how I can require the JSON in the first place
@conaw how will the data be deployed?
you can't require json, since json doesn't have namespaces for starters