diff options
Diffstat (limited to 'client-web/source/resource/file.ts')
-rw-r--r-- | client-web/source/resource/file.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/client-web/source/resource/file.ts b/client-web/source/resource/file.ts index b882e1e..ad09ad2 100644 --- a/client-web/source/resource/file.ts +++ b/client-web/source/resource/file.ts @@ -116,15 +116,18 @@ export function create_file_res(): Promise<LocalResource> { function file_res_inner(file: File): LocalResource { const transfers_el = e("div", {}) const transfers_abort = new Set<() => void>() + let destroy: () => void; return { info: { kind: "file", id: Math.random().toString(), label: file.name, size: file.size }, destroy() { transfers_abort.forEach(abort => abort()) }, el: e("div", { class: "file" }, + e("button", { class: "abort", onclick(_) { destroy() } }, "Stop sharing"), e("span", {}, `Sharing file: ${JSON.stringify(file.name)}`), transfers_el ), + set_destroy(cb) { destroy = cb }, on_request(user, create_channel) { const channel = create_channel() channel.bufferedAmountLowThreshold = 1 << 16 // this appears to be the buffer size in firefox for reading files |