@nextcloud/viewer
    Preparing search index...

    Interface ViewerBeforeDownloadDetail

    What the viewer hands the element of the handler showing a file, with the before-download event it dispatches on it before downloading that file, from its own Download, Ctrl+S or the Files download action. A handler with edits not written yet saves them first:

    element.addEventListener('before-download', (event) => {
    if (dirty) {
    event.detail.waitUntil(save())
    }
    })

    A promise that rejects cancels the download, and the viewer says so.

    interface ViewerBeforeDownloadDetail {
        file: IFile;
        waitUntil(promise: Promise<unknown>): void;
    }
    Index
    file: IFile

    The file about to be downloaded

    • Hold the download until the promise settles

      Parameters

      • promise: Promise<unknown>

        What the download waits for

      Returns void