8 ms·
I could not find this info in the docs or the faq: Is Biff suitable for a Javascript front end? is there an API for a plain JS frontend to use Biff? (I like clo
by raphar 6y ago
I could not find this info in the docs or the faq:
Is Biff suitable for a Javascript front end? is there an API for a plain JS frontend to use Biff? (I like clojure backends with boring JS in the front)
That's my only question about it. Thank you for sharing it. I found the project very enjoyable to browse and really appreciate that you shared several of your key design decisions.
Good Work!
- jacobobryant 6y agoThanks! I haven't used a plain JS backend with it myself, but I think that would work well (the majority of Biff is backend code anyway). I haven't exposed a JS api, but doing so should be pretty easy. All of Biff's frontend code is in the biff.client namespace, and the only function you need is biff.client/init-sub [1], which takes: - an atom, the contents of which describe what data you're subscribing to - another atom, which is populated with the results of your subscriptions - a function for handling server-sent websocket events (if your app uses any) and it returns a function for sending websocket events to the server (which is used for sending transactions + any custom events you define). [1] https://github.com/jacobobryant/biff/blob/98ad188924bee9121d3870d2a3500519ded76eb1/example/src/example/client/app.cljs#L18 https://github.com/jacobobryant/biff/blob/98ad188924bee9121d...