Comments (6)
In general I would like the API of kee-frame to be as simple as possible, preferring generic lower level constructs over specific higher level ones. That will make it easier to maintain a stable API in the long term, and makes everything more composable.
In this case, that would mean allowing interceptors per event, the same way re-frame does. It would be convenient to specify global interceptors for a chain, but it comes with the penalty of cluttering the API. It would need to be very valuable to justify it, given that it only reduces code size, not complexity.
from kee-frame.
Thanks for reporting!
I will look into this. for the -named
chains, the API starts to get messy. I would like to support this, but at the same time not make the core API to complicated for the 90% of users that only need the simple cases. Please feel free to drop in some usage examples, with suggested API, so we can discuss!
from kee-frame.
The two options I can think of are to use the same interceptor for all, or interpose an interceptor for each one.
e.g. 1
(reg-chain
:load/foo
[auth/logged-in? (path [:path :to :foo])]
(fn [ctx ev]
;; step 1
...)
(fn [ctx ev]
;; Step 2
...))
(reg-chain-named
:load/foo
[auth/logged-in? (path [:path :to :foo])]
(fn [ctx ev]
;; step 1
...)
:foo/set
(fn [ctx ev]
;; Step 2
...))
e.g. 2
(reg-chain
:load/foo
[auth/logged-in?]
(fn [ctx ev]
;; step 1
...)
[auth/audit-success (path [:path :to :foo])]
(fn [ctx ev]
;; Step 2
...))
(reg-chain-named
:load/foo
[auth/logged-in?]
(fn [ctx ev]
;; step 1
...)
:foo/set
[auth/audit-success (path [:path :to :foo])]
(fn [ctx ev]
;; Step 2
...))
from kee-frame.
Well put. I agree.
from kee-frame.
Is this something you would consider doing as a pull request? I'm thinking about it,, but could take some time as I'm quite busy these days.
from kee-frame.
I actually think I solved it. Will write some more tests, and call it a day.
from kee-frame.
Related Issues (20)
- ::fsm/on-enter subject to race condition HOT 3
- `switch-route` doesn't seem to honour the `nil` case HOT 4
- Unable to set the order of the controllers HOT 1
- Consider allowing specifying actions on DB spec check failure HOT 1
- Consider splitting statecharts-re-frame integration into a separate library HOT 1
- Use speced.def for some core APIs
- "Scroll behavior on navigation" section of the readme seems to be outdated. HOT 2
- Hash Routing on subdirectory not working
- Feature Request: On navigate fx option in `navigate-to` effect.
- Upgrade some of your dependencies HOT 1
- reagent.core/render is deprecated HOT 1
- API for overriding certain interceptors
- Controller 2's :start is called before Controller 1's :stop HOT 4
- Use a logging library for debug logging HOT 1
- Using path-params in navigate-to fx HOT 5
- Question regarding reg-controller HOT 7
- Upgrade to re-frame 1.0
- FSM: stop/start behaviour clarification HOT 3
- How does the section about logging relate to the source code?
- Upgrade com.taoensso/timbre dep to avoid compilation warnings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kee-frame.