Skip to content

Before finish gets blob #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion JsonExcel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
/*
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -238,8 +238,9 @@ export default {
startDownload(){
alert('show loading');
},
finishDownload(){
finishDownload(blob){
alert('hide loading');
alert(`file size: ${blob.size}`);
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down