-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d4dae8
commit 60ead92
Showing
28 changed files
with
1,189 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns re-frisk.clipboard) | ||
|
||
(defn copy-to-clip [text] | ||
(let [el (.createElement js/document "textarea")] | ||
(set! (.-value el) text) | ||
(.appendChild js/document.body el) | ||
(.select el) | ||
(.execCommand js/document "copy") | ||
(.removeChild js/document.body el))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
(ns re-frisk.stat | ||
(:require [re-frame.registrar :as reg])) | ||
|
||
(defn assoc-map [acc key] | ||
(assoc acc key {:cnt 0 :ms 0})) | ||
|
||
(defn get-re-frame-handlers [] | ||
{:fx (reduce assoc-map {} (keys (dissoc (:fx @reg/kind->id->handler) | ||
:dispatch-later | ||
:fx | ||
:dispatch | ||
:dispatch-n | ||
:deregister-event-handler | ||
:db))) | ||
:cofx (reduce assoc-map {} (keys (dissoc (:cofx @reg/kind->id->handler) :db))) | ||
:event (reduce assoc-map {} (keys (:event @reg/kind->id->handler))) | ||
:sub (reduce assoc-map {} (keys (:sub @reg/kind->id->handler)))}) | ||
|
||
(defn init-stat [re-frame-data] | ||
(when (empty? @(:stat re-frame-data)) | ||
(reset! (:stat re-frame-data) (get-re-frame-handlers)))) | ||
|
||
(defn update-trace-stat [re-frame-data traces] | ||
(doseq [{:keys [event subs duration effects coeffects]} traces] | ||
(when event | ||
(swap! (:stat re-frame-data) update-in [:event (first event) :cnt] inc) | ||
(swap! (:stat re-frame-data) update-in [:event (first event) :ms] + duration) | ||
(when (pos? (count effects)) | ||
(doseq [key (keys effects)] | ||
(swap! (:stat re-frame-data) update-in [:fx key :cnt] inc))) | ||
(when (pos? (count coeffects)) | ||
(doseq [key (keys coeffects)] | ||
(swap! (:stat re-frame-data) update-in [:cofx key :cnt] inc)))) | ||
(when (seq subs) | ||
(doseq [{:keys [op-type operation duration]} subs] | ||
(when (= op-type :sub/run) | ||
(swap! (:stat re-frame-data) update-in [:sub operation :cnt] inc) | ||
(swap! (:stat re-frame-data) update-in [:sub operation :ms] + duration)))))) | ||
|
||
(defn update-event-stat [re-frame-data event] | ||
(swap! (:stat re-frame-data) update-in [:event event :cnt] inc)) |
Oops, something went wrong.