Git Product home page Git Product logo

Comments (6)

ingesolvoll avatar ingesolvoll commented on August 22, 2024 1

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.

ingesolvoll avatar ingesolvoll commented on August 22, 2024

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.

SVMBrown avatar SVMBrown commented on August 22, 2024

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.

SVMBrown avatar SVMBrown commented on August 22, 2024

Well put. I agree.

from kee-frame.

ingesolvoll avatar ingesolvoll commented on August 22, 2024

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.

ingesolvoll avatar ingesolvoll commented on August 22, 2024

I actually think I solved it. Will write some more tests, and call it a day.

from kee-frame.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.