From fe4eb688a38a3660919ca977999e49ccd61688eb Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 16 Feb 2018 13:03:22 -0800 Subject: [PATCH] Fixed FileDialog.save to require FileSaver.js when using CommonJS --- lime/ui/FileDialog.hx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lime/ui/FileDialog.hx b/lime/ui/FileDialog.hx index 699d47a91..3d624ae2a 100644 --- a/lime/ui/FileDialog.hx +++ b/lime/ui/FileDialog.hx @@ -274,7 +274,11 @@ class FileDialog { var path = defaultPath != null ? Path.withoutDirectory (defaultPath) : "download" + defaultExtension; var buffer = (data:Bytes).getData (); + #if commonjs + untyped __js__ ("require ('file-saverjs')") (new Blob ([ buffer ], { type: type }), path, true); + #else untyped window.saveAs (new Blob ([ buffer ], { type: type }), path, true); + #end onSave.dispatch (path); return true;