4

I'm working with Noir and I can't figure out how to pass information to the views. Right now I have a ref in proj.core/my-ref which is updated in a worker thread. I need to access the ref's value from a view created via defpage located at proj.views.my-view.

What would be the idiomatic way of sharing this ref? I was thinking of passing it in a closure somehow but I don't see how that would work with the way noir pulls in the views

ie

(noir.server/load-views-ns 'proj.views)
Ilia Choly
  • 18,070
  • 14
  • 92
  • 160

1 Answers1

2

Move the ref to it's own namespace and then just require proj.core in your proj.views, like:

(ns proj.views
 (:require proj.model))

(defpage "/foo" [] (@proj.model/my-ref)
DanLebrero
  • 8,545
  • 1
  • 29
  • 30