From d947fe1c050a9e7bb1dfb53f67bb567697c9e470 Mon Sep 17 00:00:00 2001 From: juliandescottes Date: Mon, 10 Oct 2016 02:17:19 +0200 Subject: [PATCH] add blob type --- src/js/service/storage/FileDownloadStorageService.js | 2 +- src/js/utils/FileUtils.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/service/storage/FileDownloadStorageService.js b/src/js/service/storage/FileDownloadStorageService.js index 5eb26ded..9ef2f15e 100644 --- a/src/js/service/storage/FileDownloadStorageService.js +++ b/src/js/service/storage/FileDownloadStorageService.js @@ -13,7 +13,7 @@ var fileName = piskelName + '-' + timestamp + '.piskel'; try { - pskl.utils.FileUtils.downloadAsFile(new Blob([serialized]), fileName); + pskl.utils.FileUtils.downloadAsFile(new Blob([serialized], {type : 'application/piskel+json'}), fileName); deferred.resolve(); } catch (e) { deferred.reject(e.message); diff --git a/src/js/utils/FileUtils.js b/src/js/utils/FileUtils.js index 1bbbf19a..ff22335c 100644 --- a/src/js/utils/FileUtils.js +++ b/src/js/utils/FileUtils.js @@ -8,9 +8,9 @@ ns.FileUtils = { readFile : function (file, callback) { var reader = new FileReader(); - reader.onload = function (event) { - callback(event.target.result); - }; + reader.addEventListener('loadend', function() { + callback(reader.result); + }); reader.readAsDataURL(file); },