
* feat: [#21] stand up file sharing controls UI * feat: [#21] implement basic file transfer * feat: [#21] save transferred file * feat: [#21] transfer file via WebTorrent * fix: use external streamsaver assets * feat: [#21] initiate download by receiver click * fix: enable re-downloading of shared files * feat: [#21] implement sharing of multiple files * chore: enable offline development * feat: cache torrents in IndexedDB * feat: show alert when download is aborted * feat: [#21] clean up torrent data when principal offerer rescinds it * feat: clean up cached torrents on page unload * feat: show file transfer progress * fix: download files sequentially * feat: clean up file transfers when leaving the room * feat: clean up broken downloads upon leaving the page * fix: allow download animation to complete * feat: show tooltip for download button * feat: make file transfers work in browser private modes * feat: disable file share controls while creating offer
17 lines
396 B
TypeScript
17 lines
396 B
TypeScript
export const sleep = (milliseconds: number): Promise<void> =>
|
|
new Promise<void>(res => {
|
|
setTimeout(res, milliseconds)
|
|
})
|
|
|
|
export const isRecord = (variable: any): variable is Record<string, any> => {
|
|
return (
|
|
typeof variable === 'object' &&
|
|
!Array.isArray(variable) &&
|
|
variable !== null
|
|
)
|
|
}
|
|
|
|
export const isError = (e: any): e is Error => {
|
|
return e instanceof Error
|
|
}
|