Skip to content
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

local-conn vs conn? #1

Open
atroche opened this issue Aug 26, 2015 · 1 comment
Open

local-conn vs conn? #1

atroche opened this issue Aug 26, 2015 · 1 comment

Comments

@atroche
Copy link

atroche commented Aug 26, 2015

Hi @thegeez! How come you have a conn and a local-conn that both get transacted on when e.g. the db function remove-item is called?

@thegeez
Copy link
Owner

thegeez commented Aug 26, 2015

Hi @atroche,

The todo-app front-end of clj-crud was made to work both as a version with a database back-end and as a stand-alone in-browser only version.

In services.cljs the actions are handled with

(defmulti handle
  (fn [event args db conn] event))

In client_services.cljs the actions are handled with

(defmulti handle
  (fn [event args db conn local-conn] event))

services.cljs is used for the version with a server back-end and does all the requests over HTTP. client_services.cljs is used for a stand-alone front-end without any persistence. The local-conn in client_services.cljs is the substitute for the database on the server in services.cljs.

conn is the state on the front-end that the renderer uses and where the user interactions end up in. It would have been possible to re-use conn for local-conn but for modularity they are separate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants