avatar image - a green paisley swirl bits all the way down
December 18, 2023
By: Nundrum

Stumbling Through Interop

》Surely I can just cargo cult this

After making so much process building a progressive web app, I decided to take a detour into making some "simpler" pages, without re-frame. To pull in some EDN data to work with, I quickly needed to figure out how to use fetch. JavaScript interop looks like Java interop, right? Objects, members, methods. What works in one place should work in the other. Right?

》Enter promises and consternation

I started playing around just by seeing what fetch returns:

(js/fetch edn-url ) ; => #object[Promise [object Promise]]

Getting a promise object in return was not a surprise. Previous work taught me that JS uses async code and promises heavily. Which makes sense — any blocking of a page’s JS thread leads to a frozen page. Treating the promise like a magic bottlecap, I reach for the handy old tools realized? and deref:

(realized? (js/fetch edn-url )); => :repl/exception!
(deref (js/fetch edn-url )); => :repl/exception!

Oh, no! This isn’t the same at all.

Continue reading →
December 7, 2023
By: Nundrum

From Clojure to ClojureScript

》A Journey

How do you get from Clojure to ClojureScript? Though I have had much practice with Clojure and understand the ecosystem around it, understanding the environment of ClojureScript has remained elusive. Surely it is possible to use ClojureScript without having a deep understanding of JavaScript, just like most Clojure code can be written with minimal Java knowledge?

I had dabbled in some JavaScript before — enough to know that I would rather be writing ClojureScript if at all possible. But most of the advice given to me was along the lines of: "go learn JavaScript React and come back later." Almost as if the only people coming to ClojureScript were JavaScript developers!

Here is what I’ve learned as I struggled to put a web app together. I hope it helps other developers who might be coming from a similar background.

Continue reading →
« Prev

A blog by Nundrum

Links

  • @Nundrum on Mastodon
  • Clojurians Slack
  • Archives
  • RSS

Pages

  • Contacting Nundrum
  • P.E.P.R. Jacket Project

Recent Posts

  • P.E.P.R. Codex
  • Clojure and D-Bus
  • Clojure, Babashka, and Web CGI

Tags

  • re-frame
  • clojure
  • svg
  • async
  • interop
  • jna
  • cli
  • screensaver
  • platformio
  • font
  • babashka
  • utility
  • pepr jacket project
  • cyberpunk
  • clojurescript
  • selfhosting

Copyright © 2026 Nundrum

Powered by Cryogen