1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-06 18:33:38 +02:00

Start restructuring audio playback, add some tests for audio

Fixes #15 where audio was not stopped on logout
This commit is contained in:
Arne Schlüter 2018-08-01 18:36:47 +02:00
commit 80225d46b1
10 changed files with 187 additions and 69 deletions

View file

@ -6,3 +6,14 @@
[cofx ev]
(let [all-events (conj (get cofx :dispatch-n []) (:dispatch cofx))]
(boolean (some #(= ev (if (vector? ev) % (first %))) all-events))))
(defn rand-str
"Generates a random string; ported from https://stackoverflow.com/a/27747377/2345852"
([] (rand-str 40))
([len]
(let [arr (js/Uint8Array. (/ len 2))]
(.. js/window -crypto (getRandomValues arr))
(.. js/Array
(from arr #(-> (str 0 (.toString % 16))
(.substr -2)))
(join "")))))