Does scittle not have clojure.core/promise? I don’t know how to make js/Promise work for me. I want to make a promise, put it somewhere, and deliver to it later.
:msg "{:ex \"\\\"#error {:message \\\\\\\"Could not resolve symbol: promise\\\\\\\", :data {:type :sci/error, :line 1, :column 1, :message \\\\\\\"Could not resolve symbol: promise\\\\\\\", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:line 1, :column 1, :ns #object[To main], :file nil})}], :file nil, :phase \\\\\\\"analysis\\\\\\\"}, :cause #error {:message \\\\\\\"Could not resolve symbol: promise\\\\\\\", :data {:type :sci/error, :line nil, :column nil, :file nil, :phase \\\\\\\"analysis\\\\\\\"}}}\\\"\", :status [\"error\" \"done\"], :id \"354\", :session \"aef012af-d259-442d-91e3-5e1712963442\", :ns \"main\"}"I want to register with a websocket so that on message I deliver to the promise.
You can do this like this in JS:
(js/Promise. (fn [resolve reject]
(resolve 10))
You can do anything you want instead of (resolve 10) to send 10 to the part of the program that's waiting on that promiseIm trying to deliver it from the onmessage of a websocket that i registered before constructing the promise.
Sorry. Afk atm.
Yeah, you can do:
(let [!resolve (atom nil) prom (js/Promise. (fn [resolve reject] (reset! !resolve resolve)))]
(onreceive [msg] (@!resolve msg))
(pseudo-code, but you get the idea)I’m trying to proxy http requests through my local to get around cors.
Taking you psuedo-code further, it would look like this.
That does seem to work. I guess I’ll just use that for now.
server code