diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-04-19 16:13:36 +0200 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-04-19 16:35:54 +0200 |
commit | 0019d7e79c09f498b8b12c49fe966e58d028f52e (patch) | |
tree | 39d04061f9b2e550305ff8b16f96a3ddfa0d6126 /src | |
parent | a582e823f8103d8ae45f698238d2bc6d85bcf5c4 (diff) |
feat: refine effect handlers
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/tubo/events.cljs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/frontend/tubo/events.cljs b/src/frontend/tubo/events.cljs index 401de69..678a0db 100644 --- a/src/frontend/tubo/events.cljs +++ b/src/frontend/tubo/events.cljs @@ -94,7 +94,7 @@ ::player-src (fn [{:keys [player src current-pos]}] (set! (.-src @player) src) - (set! (.-onended @player) #(rf/dispatch [::change-media-queue-pos (+ current-pos 1)])))) + (set! (.-onended @player) #(rf/dispatch [::change-media-queue-pos (inc current-pos)])))) (rf/reg-fx ::player-pause @@ -154,9 +154,9 @@ (.setActionHandler js/navigator.mediaSession "play" #(.play @player)) (.setActionHandler js/navigator.mediaSession "pause" #(.pause @player)) (.setActionHandler js/navigator.mediaSession "previoustrack" - #(rf/dispatch [::change-media-queue-pos (- current-pos 1)])) + #(rf/dispatch [::change-media-queue-pos (dec current-pos)])) (.setActionHandler js/navigator.mediaSession "nexttrack" - #(rf/dispatch [::change-media-queue-pos (+ current-pos 1)])) + #(rf/dispatch [::change-media-queue-pos (inc current-pos)])) (.setActionHandler js/navigator.mediaSession "seekbackward" (fn [^js/navigator.MediaSessionActionDetails details] (set! (.-currentTime @player) @@ -377,7 +377,7 @@ (assoc :media-queue-pos idx) (assoc-in [:media-queue idx :stream] "")) :store (assoc store :media-queue-pos idx) - :fx [[:dispatch [::fetch-audio-player-stream (:url stream) idx true]]]})))) + :fx [[:dispatch [::fetch-audio-player-stream stream idx true]]]})))) (rf/reg-event-fx ::change-media-queue-stream @@ -414,7 +414,7 @@ :store (-> store (assoc :show-audio-player true) (assoc :media-queue (:media-queue updated-db))) - :fx [[:dispatch [::fetch-audio-player-stream (:url stream) idx (= (count (:media-queue db)) 0)]]]}))) + :fx [[:dispatch [::fetch-audio-player-stream stream idx (= (count (:media-queue db)) 0)]]]}))) (rf/reg-event-fx ::start-stream-radio |