Browse Source

enhance(rtc): add command :dev/rtc-start

rcmerci 8 months ago
parent
commit
b2ae56fdb6

+ 5 - 1
src/main/frontend/handler/common/developer.cljs

@@ -5,6 +5,7 @@
             [frontend.config :as config]
             [frontend.config :as config]
             [frontend.db :as db]
             [frontend.db :as db]
             [frontend.format.mldoc :as mldoc]
             [frontend.format.mldoc :as mldoc]
+            [frontend.handler.db-based.rtc :as rtc-handler]
             [frontend.handler.notification :as notification]
             [frontend.handler.notification :as notification]
             [frontend.persist-db :as persist-db]
             [frontend.persist-db :as persist-db]
             [frontend.state :as state]
             [frontend.state :as state]
@@ -103,4 +104,7 @@
   (state/pub-event! [:dialog-select/db-graph-replace]))
   (state/pub-event! [:dialog-select/db-graph-replace]))
 
 
 (defn ^:export rtc-stop []
 (defn ^:export rtc-stop []
-  (state/<invoke-db-worker :thread-api/rtc-stop))
+  (rtc-handler/<rtc-stop!))
+
+(defn ^:export rtc-start []
+  (rtc-handler/<rtc-start! (state/get-current-repo)))

+ 7 - 1
src/main/frontend/modules/shortcut/config.cljs

@@ -641,7 +641,11 @@
    :dev/rtc-stop {:binding []
    :dev/rtc-stop {:binding []
                   :db-graph? true
                   :db-graph? true
                   :inactive (not (state/developer-mode?))
                   :inactive (not (state/developer-mode?))
-                  :fn :frontend.handler.common.developer/rtc-stop}})
+                  :fn :frontend.handler.common.developer/rtc-stop}
+   :dev/rtc-start {:binding []
+                   :db-graph? true
+                   :inactive (not (state/developer-mode?))
+                   :fn :frontend.handler.common.developer/rtc-start}})
 
 
 (let [keyboard-commands
 (let [keyboard-commands
       {::commands (set (keys all-built-in-keyboard-shortcuts))
       {::commands (set (keys all-built-in-keyboard-shortcuts))
@@ -871,6 +875,7 @@
           :dev/validate-db
           :dev/validate-db
           :dev/fix-broken-graph
           :dev/fix-broken-graph
           :dev/rtc-stop
           :dev/rtc-stop
+          :dev/rtc-start
           :ui/customize-appearance])
           :ui/customize-appearance])
         (with-meta {:before m/enable-when-not-editing-mode!}))
         (with-meta {:before m/enable-when-not-editing-mode!}))
 
 
@@ -1065,6 +1070,7 @@
      :dev/validate-db
      :dev/validate-db
      :dev/fix-broken-graph
      :dev/fix-broken-graph
      :dev/rtc-stop
      :dev/rtc-stop
+     :dev/rtc-start
      :ui/clear-all-notifications]
      :ui/clear-all-notifications]
 
 
     :shortcut.category/plugins
     :shortcut.category/plugins

+ 1 - 0
src/resources/dicts/en.edn

@@ -788,4 +788,5 @@
   :dev/validate-db "(Dev) Validate current graph"
   :dev/validate-db "(Dev) Validate current graph"
   :dev/fix-broken-graph "(Dev) Fix current broken graph"
   :dev/fix-broken-graph "(Dev) Fix current broken graph"
   :dev/rtc-stop "(Dev) RTC Stop"
   :dev/rtc-stop "(Dev) RTC Stop"
+  :dev/rtc-start "(Dev) RTC Start"
   :window/close "Close window"}}
   :window/close "Close window"}}