-
-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instrumenting registered functions #552
Comments
Just watched Alex Miller's ClojuTre talk. It includes some discussion of spec2. Some talk of defining spec's as part of |
OkLetsPlay uses Orchestra's ; Event
(def-event ::view
([db ::d/db, match-id ::t.match/id, opponent-id ::t.user/id]
{:dispatch-n [[::found-active match-id]
[::bind match-id]
[::chat.event/initiate opponent-id false]]}))
; Effect
(def-effect ::show-overlay
([show? boolean?]
(if show?
(framework/open-window! "overlay")
(framework/close-window! "overlay"))))
; Sub
(def-sub ::all-known (s/nilable ::leaderboard.spec/all-known)
([db ::d/db, _ (event/args)]
(::leaderboard.spec/all-known db))) |
@jeaye This looks really useful, any plans on open sourcing those macros? |
@knubie Probably not, just since they're so integrated with OkLetsPlay's existing code. However, Orchestra comes with We will be open sourcing a different library related to this here soon, which aims to solve some problem's in re-frame's design with regard to events and callback hell. Stay tuned for that! |
@jeaye Cool, looking forward to it! |
I'm looking for a way to use spec to instrument my event handlers & subs.
I run
stest/instrument
in a :preload namespace. Since that ns requires all my handler code it happens after(re-frame/reg-event-fx :myfn myfn)
executes so the uninstrumented fn is captured.I could move all my
re-frame/reg-event-fx
calls to a different ns and (e.g.app.core
) and make sure it loads after instrumentation has happened. Perhaps there are better techniques. I've seen examples in the documentation of using an interceptor to check the db value.The text was updated successfully, but these errors were encountered: