enhance(rtc): deprecate <wrap-ensure-id&access-token

This commit is contained in:
rcmerci
2024-12-03 17:10:06 +08:00
parent eb273f1aff
commit a2b3efa86f
4 changed files with 63 additions and 80 deletions

View File

@@ -1,10 +1,9 @@
(ns frontend.common.async-util
"Some cljs.core.async relate macros and fns, used in worker and frontend
namespaces. See also: https://gist.github.com/vvvvalvalval/f1250cec76d3719a8343"
#?(:cljs (:require [promesa.core :as p]
[logseq.common.util :as common-util]
#?(:cljs (:require [cljs.core.async.impl.channels :refer [ManyToManyChannel]]
[clojure.core.async :as async]
[cljs.core.async.impl.channels :refer [ManyToManyChannel]])))
[logseq.common.util :as common-util])))
#?(:cljs
(defn throw-err
@@ -15,20 +14,6 @@
[port]
`(throw-err (cljs.core.async/<! ~port)))
#?(:cljs
(defn c->p
"Converts a Core.async channel to a Promise"
[chan]
(let [d (p/deferred)]
(if chan
(async/go
(let [result (async/<! chan)]
(if (instance? ExceptionInfo result)
(p/reject! d result)
(p/resolve! d result))))
(p/resolve! d nil))
d)))
#?(:cljs
(defn drain-chan
"drop all stuffs in CH, and return all of them"
@@ -87,4 +72,4 @@
;; so we stop the whole go-loop
(nil? e))
(async/close! ch))))
ch)))
ch)))