mpdairy / posh

A luxuriously simple and powerful way to make front-ends with DataScript and Reagent in Clojure.
Eclipse Public License 1.0
460 stars 45 forks source link

Added backend (server-side) Posh functionality + reactions; modularized plugins #16

Closed alexandergunnarson closed 7 years ago

alexandergunnarson commented 7 years ago

Hey @mpdairy (@metasoarous may be interested as well)!

1) I added server-side (CLJ) reactivity — ratoms, reactions, etc. — using Reagent as the reference implementation (I ported reagent.ratom to .cljc). It would be nice to add this portion of the PR to Reagent itself, so every time the ratom implementation changes in Reagent, it can correspondingly change here. But anyway, a goal for another day. (Oh, and all ratom tests, ported from Reagent to .cljc, pass!). Note that reactions (I think ratoms too) are currently single-threaded, as the Reagent version. This can change pretty straightforwardly, though. 2) I modularized the plugin system you have. All plugins can now use posh.plugin-base, as exemplified by posh.reagent and posh.clj.datascript. 3) I've begun work on posh.clj.datomic but haven't completed/tested it yet. It may require some non-trivial work around the equivalent of datascript.core/listen!, but we'll see. I'll write some tests for that and the DataScript implementation.

Let me know how I can help further! Long live Posh!

Thanks, Alex

alexandergunnarson commented 7 years ago

P.S. — If you'd like to test the .clj implementation quickly:

(do (set! *warn-on-reflection* true)
    (load-file "./src/posh/lib/ratom.cljc")
    (load-file "./test/posh/lib/ratom_test.cljc")
    (eval '(clojure.test/run-tests 'posh.lib.ratom-test)))

(Also, should we now add in e.g. CircleCI?)

mpdairy commented 7 years ago

Hey Alex, this is great! Should be really big. We'll have to add how to use it to the Readme and give you big cred. I might just add you as developer to the repository so you can change things, and then we can set up circleCI to automatically do the clojars stuff.

I'll try it later today. I recently reinstalled Ubuntu and I don't even have Clojure set up yet.

So did you make any changes to q or pull? Did you figure out a way to make the filter functions more useful?

alexandergunnarson commented 7 years ago

Thanks so much!! I'd love to be a developer on the repo if you do decide that. I didn't make any changes to how any functions work in terms of the user-facing API or their functionality - the only changes I made that way were to add the config as the first param in certain functions in the lib files. And yeah, let me know what you think once you try it!

metasoarous commented 7 years ago

Wonderful work @alexandergunnarson! Looking forward to playing with this. I've been trudging forward with Datsync, and am excited to thread the pieces together.