Merge branch 'master' of https://github.com/Day8/re-frame
This commit is contained in:
commit
7a20fd767b
|
@ -5,6 +5,14 @@
|
||||||
- add `purge-event-queue` to the API. See https://github.com/Day8/re-frame-test/issues/13 for motivation.
|
- add `purge-event-queue` to the API. See https://github.com/Day8/re-frame-test/issues/13 for motivation.
|
||||||
- added [a new FAQ entry](/docs/FAQs/DoINeedReFrame.md) Reagent looks terrific. Why do I need re-frame?
|
- added [a new FAQ entry](/docs/FAQs/DoINeedReFrame.md) Reagent looks terrific. Why do I need re-frame?
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
- Debounce trace callbacks to handle larger batches of traces at once, to improve efficiency.
|
||||||
|
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
- Handle js/performance not being defined in NodeJS. [#439](https://github.com/Day8/re-frame/pull/439)
|
||||||
|
|
||||||
## 0.10.2 (2017.10.07)
|
## 0.10.2 (2017.10.07)
|
||||||
|
|
||||||
#### New Features
|
#### New Features
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../re-frame-trace/
|
|
@ -18,6 +18,7 @@ Please add to this list by submitting a pull request.
|
||||||
|
|
||||||
### Examples and Applications Using re-frame
|
### Examples and Applications Using re-frame
|
||||||
|
|
||||||
|
* [RealWorld](https://github.com/jacekschae/conduit) - heavily inspired by [todomvc](https://github.com/Day8/re-frame/tree/master/examples/todomvc) - well commented codebase with CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld) spec and API.
|
||||||
* [BlueGenes](https://github.com/intermine/bluegenes) - searching and analysing genomic data, by the University of Cambridge
|
* [BlueGenes](https://github.com/intermine/bluegenes) - searching and analysing genomic data, by the University of Cambridge
|
||||||
* [Memento](https://gitlab.com/Numergent/memento) a private note-taking app. Uses compojure-api, PostgreSQL and token auth.
|
* [Memento](https://gitlab.com/Numergent/memento) a private note-taking app. Uses compojure-api, PostgreSQL and token auth.
|
||||||
* [RealWord](https://github.com/polymeris/re-frame-realword-example-app) has CRUD, auth. Adheres to [RealWorld](https://github.com/gothinkster/realworld) spec and API.
|
* [RealWord](https://github.com/polymeris/re-frame-realword-example-app) has CRUD, auth. Adheres to [RealWorld](https://github.com/gothinkster/realworld) spec and API.
|
||||||
|
@ -66,6 +67,8 @@ Please add to this list by submitting a pull request.
|
||||||
* [Stately: State Machines](https://github.com/nodename/stately) also https://www.youtube.com/watch?v=klqorRUPluw
|
* [Stately: State Machines](https://github.com/nodename/stately) also https://www.youtube.com/watch?v=klqorRUPluw
|
||||||
* [re-learn](https://github.com/oliyh/re-learn) - Data driven tutorials for educating users of your reagent / re-frame app
|
* [re-learn](https://github.com/oliyh/re-learn) - Data driven tutorials for educating users of your reagent / re-frame app
|
||||||
* [subgraph](https://github.com/vimsical/subgraph) - Reactive graph database for re-frame
|
* [subgraph](https://github.com/vimsical/subgraph) - Reactive graph database for re-frame
|
||||||
|
* [re-graph](https://github.com/oliyh/re-graph) - GraphQL client for re-frame
|
||||||
|
* [martian](https://github.com/oliyh/martian) - Swagger-compatible API client that abstracts away from HTTP with [re-frame bindings](https://github.com/oliyh/martian/tree/master/re-frame)
|
||||||
|
|
||||||
#### Debugging
|
#### Debugging
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,11 @@ is there in the extra layers and conceptual overhead it brings?
|
||||||
|
|
||||||
### Answer
|
### Answer
|
||||||
|
|
||||||
Yes, we agree, Reagent is terrific. And, yes, we'd agree that if your application
|
Yes, we agree, Reagent is terrific. We use it enthusiastically ourselves. And, yes, we'd agree that if your application
|
||||||
is small and simple, then standalone Reagent is a fine choice.
|
is small and simple, then standalone Reagent is a fine choice.
|
||||||
|
|
||||||
But it does only supplies the V part of the MVC triad. As your application
|
But it does only supply the V part of the MVC triad. As your application
|
||||||
gets bigger and more complicated, you'll need to find solutions to
|
gets bigger and more complicated, you *will* need to find solutions to
|
||||||
questions in the M and C realms.
|
questions in the M and C realms.
|
||||||
|
|
||||||
Questions like "where do I put control logic?".
|
Questions like "where do I put control logic?".
|
||||||
|
|
|
@ -9,8 +9,8 @@ You'll want to investigate CQRS (vs REST).
|
||||||
|
|
||||||
##### Notes
|
##### Notes
|
||||||
|
|
||||||
1. Perhaps watch [Bobby Calderwood's video](https://www.youtube.com/watch?v=B1-gS0oEtYc)
|
1. Perhaps watch [Bobby Calderwood's video](https://www.youtube.com/watch?v=B1-gS0oEtYc)?
|
||||||
2. Look at his [reference implmentation](https://github.com/capitalone/cqrs-manager-for-distributed-reactive-services) or, perhaps, [this alternative](https://github.com/greywolve/calderwood)
|
2. Look at his [reference implementation](https://github.com/capitalone/cqrs-manager-for-distributed-reactive-services) or, perhaps, [this alternative](https://github.com/greywolve/calderwood).
|
||||||
4. Be aware that "Event Sourcing" often comes along for the ride
|
4. Be aware that "Event Sourcing" often comes along for the ride
|
||||||
with CQRS, but it doesn't have to. It adds complexity (Kafka?).
|
with CQRS, but it doesn't have to. It adds complexity (Kafka?).
|
||||||
Don't do it lightly. Maybe just use CQRS without ES?
|
Don't do it lightly. Maybe just use CQRS without ES?
|
||||||
|
@ -20,11 +20,10 @@ You'll want to investigate CQRS (vs REST).
|
||||||
|
|
||||||
### Further Related Links
|
### Further Related Links
|
||||||
|
|
||||||
Reactive PostgreSQL:
|
* Reactive PostgreSQL:
|
||||||
https://yogthos.net/posts/2016-11-05-LuminusPostgresNotifications.html
|
https://yogthos.net/posts/2016-11-05-LuminusPostgresNotifications.html
|
||||||
|
* Datalog All The Way Down:
|
||||||
Datalog All The Way Down
|
https://www.youtube.com/watch?v=aI0zVzzoK_E
|
||||||
https://www.youtube.com/watch?v=aI0zVzzoK_E
|
|
||||||
|
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../re-frame-trace/
|
|
@ -38,7 +38,9 @@
|
||||||
(js/setTimeout f ms))
|
(js/setTimeout f ms))
|
||||||
|
|
||||||
(defn now []
|
(defn now []
|
||||||
(if (exists? js/performance.now)
|
(if (and
|
||||||
|
(exists? js/performance)
|
||||||
|
(exists? js/performance.now))
|
||||||
(js/performance.now)
|
(js/performance.now)
|
||||||
(js/Date.now)))
|
(js/Date.now)))
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
#?(:cljs (:require-macros [net.cgrand.macrovich :as macros]
|
#?(:cljs (:require-macros [net.cgrand.macrovich :as macros]
|
||||||
[re-frame.trace :refer [finish-trace with-trace merge-trace!]]))
|
[re-frame.trace :refer [finish-trace with-trace merge-trace!]]))
|
||||||
(:require [re-frame.interop :as interop]
|
(:require [re-frame.interop :as interop]
|
||||||
|
[re-frame.loggers :refer [console]]
|
||||||
#?(:clj [net.cgrand.macrovich :as macros])
|
#?(:clj [net.cgrand.macrovich :as macros])
|
||||||
[re-frame.loggers :refer [console]]))
|
#?(:cljs [goog.functions])))
|
||||||
|
|
||||||
(def id (atom 0))
|
(def id (atom 0))
|
||||||
(def ^:dynamic *current-trace* nil)
|
(def ^:dynamic *current-trace* nil)
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
trace-enabled?)
|
trace-enabled?)
|
||||||
|
|
||||||
(def trace-cbs (atom {}))
|
(def trace-cbs (atom {}))
|
||||||
|
(defonce traces (atom []))
|
||||||
|
|
||||||
(defn register-trace-cb
|
(defn register-trace-cb
|
||||||
"Registers a tracing callback function which will receive a collection of one or more traces.
|
"Registers a tracing callback function which will receive a collection of one or more traces.
|
||||||
|
@ -45,19 +47,32 @@
|
||||||
:child-of (or child-of (:id *current-trace*))
|
:child-of (or child-of (:id *current-trace*))
|
||||||
:start (interop/now)})
|
:start (interop/now)})
|
||||||
|
|
||||||
|
(defn debounce [f interval]
|
||||||
|
#?(:cljs (goog.functions/debounce f interval)
|
||||||
|
:clj (f)))
|
||||||
|
|
||||||
|
(def run-tracing-callbacks!
|
||||||
|
(debounce
|
||||||
|
(fn []
|
||||||
|
(doseq [[k cb] @trace-cbs]
|
||||||
|
(try (cb @traces)
|
||||||
|
#?(:clj (catch Exception e
|
||||||
|
(console :error "Error thrown from trace cb" k "while storing" @traces e)))
|
||||||
|
#?(:cljs (catch :default e
|
||||||
|
(console :error "Error thrown from trace cb" k "while storing" @traces e))))
|
||||||
|
(reset! traces [])))
|
||||||
|
50))
|
||||||
|
|
||||||
|
|
||||||
(macros/deftime
|
(macros/deftime
|
||||||
(defmacro finish-trace [trace]
|
(defmacro finish-trace [trace]
|
||||||
`(when (is-trace-enabled?)
|
`(when (is-trace-enabled?)
|
||||||
(let [end# (interop/now)
|
(let [end# (interop/now)
|
||||||
duration# (- end# (:start ~trace))]
|
duration# (- end# (:start ~trace))]
|
||||||
(doseq [[k# cb#] @trace-cbs]
|
(swap! traces conj (assoc ~trace
|
||||||
(try (cb# [(assoc ~trace
|
:duration duration#
|
||||||
:duration duration#
|
:end (interop/now)))
|
||||||
:end (interop/now))])
|
(run-tracing-callbacks!))))
|
||||||
#?(:clj (catch Exception e#
|
|
||||||
(console :error "Error thrown from trace cb" k# "while storing" ~trace e#)))
|
|
||||||
#?(:cljs (catch :default e#
|
|
||||||
(console :error "Error thrown from trace cb" k# "while storing" ~trace e#))))))))
|
|
||||||
|
|
||||||
(defmacro with-trace
|
(defmacro with-trace
|
||||||
"Create a trace inside the scope of the with-trace macro
|
"Create a trace inside the scope of the with-trace macro
|
||||||
|
|
Loading…
Reference in New Issue