Appease the linter
This commit is contained in:
parent
455c103890
commit
761fb6e1d5
2 changed files with 10 additions and 11 deletions
|
@ -14,21 +14,21 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
export type getIframeFn = () => HTMLIFrameElement;
|
||||
export type getIframeFn = () => HTMLIFrameElement; // eslint-disable-line @typescript-eslint/naming-convention
|
||||
|
||||
export const DEFAULT_STYLES = {
|
||||
imgSrc: "",
|
||||
imgStyle: null, // css props
|
||||
style: "",
|
||||
textContent: "",
|
||||
}
|
||||
};
|
||||
|
||||
type DownloadOptions = {
|
||||
blob: Blob,
|
||||
name: string,
|
||||
autoDownload?: boolean,
|
||||
opts?: typeof DEFAULT_STYLES
|
||||
}
|
||||
blob: Blob;
|
||||
name: string;
|
||||
autoDownload?: boolean;
|
||||
opts?: typeof DEFAULT_STYLES;
|
||||
};
|
||||
|
||||
// set up the iframe as a singleton so we don't have to figure out destruction of it down the line.
|
||||
let managedIframe: HTMLIFrameElement;
|
||||
|
@ -90,9 +90,8 @@ export class FileDownloader {
|
|||
return iframe;
|
||||
}
|
||||
|
||||
public async download({blob, name, autoDownload = true, opts = DEFAULT_STYLES}: DownloadOptions) {
|
||||
public async download({ blob, name, autoDownload = true, opts = DEFAULT_STYLES }: DownloadOptions) {
|
||||
const iframe = this.iframe; // get the iframe first just in case we need to await onload
|
||||
console.log("@@", {blob, name, autoDownload, opts, iframe, m: iframe === managedIframe, p: this.onLoadPromise});
|
||||
if (this.onLoadPromise) await this.onLoadPromise;
|
||||
iframe.contentWindow.postMessage({
|
||||
...opts,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue