Fork me on GitHub
#pure-frame2016-06-04
>
escherize08:06:52

Now I have a good question:

escherize08:06:09

It looks like my subscription handlers are only being passed the subscription vector.

escherize08:06:47

(ns p-frame.db
  (:require-macros [reagent.ratom :refer [reaction]])
  (:require [reagent.core :as r]
            [re-frame.frame :as frame]
            [re-frame.router :as router]
            [p-frame.handlers :refer [handlers]]))

(def default-db {:name "re-frame"})

(def app-db (r/atom default-db))

(def subscriptions
  {:name (fn [& xs] (reaction xs))})

(def ^:private app-frame (frame/make-frame handlers subscriptions))
(defonce ^:private event-queue (router/make-event-queue app-frame app-db))

(def dispatch (partial router/dispatch event-queue app-frame))
(def subscribe (partial frame/subscribe app-frame))

@(subscribe [:name])
;;=> (:name)

escherize08:06:53

Here I register a subscription function that wraps everything it's given in a reaction and returns it, under the key :name. I'm wondering what the best way to allow access to app-db for the subscription

escherize08:06:57

Here in the tests, app-db (which is a number)... is simply referenced from inside the subscribe fn: https://github.com/binaryage/pure-frame/blob/master/test/re_frame/test/frame.cljs#L129

escherize08:06:27

Here's the repo that I've been messing with.

escherize08:06:12

any help around how to get the subscription functions passed the app-db atom would be 💯 💯👌:skin-tone-3:

escherize11:06:39

@darwin: Thanks that's just what I needed. I missed it because (I think) I'm using the 0.5.0-style implementation.

escherize11:06:05

@darwin: The next step in my pure-frame odessy is getting dev-cards working. Would you happen to have a reference implementation laying around? 😄

darwin11:06:57

no, haven’t used it with dev-cards specifically