From 6dd4ff66b753ffe4a15ee1f7787023dc0db05abb Mon Sep 17 00:00:00 2001 From: jurireinsalu Date: Sat, 1 Jun 2019 14:35:48 +0300 Subject: [PATCH 1/4] Now beforeFinish() hook gets the blob for possibility to examine the result or reuse the blob in JS --- JsonExcel.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JsonExcel.vue b/JsonExcel.vue index d033435..b62b70e 100644 --- a/JsonExcel.vue +++ b/JsonExcel.vue @@ -128,7 +128,7 @@ export default { export:async function(data, filename, mime) { let blob = this.base64ToBlob(data, mime); if(typeof this.beforeFinish === 'function') - await this.beforeFinish(); + await this.beforeFinish(blob); download(blob, filename, mime); }, /* From e13e525f1cf231e4adea6031b911d8488c4523cc Mon Sep 17 00:00:00 2001 From: jurireinsalu Date: Sat, 1 Jun 2019 14:40:47 +0300 Subject: [PATCH 2/4] updated documentation in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bbf246f..7d8d764 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ In your template | worksheet | string | Name of the worksheet tab. default: 'Sheet1' | | fetch | Function | Callback to fetch data before download, if it's set it runs immediately after mouse pressed and before download process. IMPORTANT: only works if no data prop is defined | | before-generate | Function | Callback to call a method right before the generate / fetch data, eg:show loading progress | -| before-finish | Function | Callback to call a method right before the download box pops out, eg:hide loading progress | +| before-finish | Function | Callback to call a method right before the download box pops out, eg:hide loading progress. Gets resulting binary blob as argument for examination or reuse. | ## Example From 4098ef19b689246401921713029023afc84ea97e Mon Sep 17 00:00:00 2001 From: jurireinsalu Date: Sat, 1 Jun 2019 14:49:24 +0300 Subject: [PATCH 3/4] Updated documentation in README.md regarding new argument 'blob' in before-finish callback --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7d8d764..9180517 100644 --- a/README.md +++ b/README.md @@ -238,8 +238,9 @@ export default { startDownload(){ alert('show loading'); }, - finishDownload(){ + finishDownload(blob){ alert('hide loading'); + alert(`file size: ${blob.size}`); } } }; From 8cedcb96fac2983718210df8713ef42e63a5f24b Mon Sep 17 00:00:00 2001 From: jurireinsalu Date: Sun, 2 Jun 2019 11:40:34 +0300 Subject: [PATCH 4/4] increased minor version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a543c5b..cb1e9c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-json-excel", - "version": "0.2.98", + "version": "0.2.99", "description": "Download your JSON as an excel or CSV file directly from the browser", "main": "JsonExcel.vue", "scripts": {