forked from coracle/flotilla
Fix some voice room bugs
This commit is contained in:
+4
-1
@@ -44,7 +44,10 @@ export const createScroller = ({
|
||||
: element.closest(".scroll-container")
|
||||
|
||||
const check = async () => {
|
||||
if (container) {
|
||||
const isHidden = (el: Element) =>
|
||||
(el as HTMLElement).offsetParent === null || el.clientHeight === 0
|
||||
|
||||
if (container && !isHidden(container)) {
|
||||
// While we have empty space, fill it
|
||||
const {scrollY, innerHeight} = window
|
||||
const {scrollHeight, scrollTop, clientHeight} = container
|
||||
|
||||
+9
-5
@@ -44,11 +44,15 @@ export const whenAborted = (signal?: AbortSignal) => {
|
||||
})
|
||||
}
|
||||
|
||||
/** Returns a promise that rejects with TimeoutError after ms. Use with Promise.race. */
|
||||
export const whenTimeout = (ms: number, opts: {message?: string} = {}) => {
|
||||
return new Promise<never>((_, reject) =>
|
||||
setTimeout(() => reject(new TimeoutError(opts.message)), ms),
|
||||
)
|
||||
/**
|
||||
* Returns a promise that rejects with TimeoutError after ms. Use with Promise.race.
|
||||
* Pass an optional signal to clear the timer when that signal aborts (self-cleaning).
|
||||
*/
|
||||
export const whenTimeout = (ms: number, opts: {message?: string; signal?: AbortSignal} = {}) => {
|
||||
return new Promise<never>((_, reject) => {
|
||||
const timeout = setTimeout(() => reject(new TimeoutError(opts.message)), ms)
|
||||
opts.signal?.addEventListener("abort", () => clearTimeout(timeout), {once: true})
|
||||
})
|
||||
}
|
||||
|
||||
export const buildUrl = (base: string | URL, ...pathname: string[]) => {
|
||||
|
||||
Reference in New Issue
Block a user