chart_plugins
1 year ago
controllers
1 year ago
modules
1 year ago
click-tracking-menu.js
1 year ago
dashboard_widget.js
2 years ago
download.js
2 years ago
index.js
1 year ago
layout.js
1 year ago
settings.js
1 year ago
download.js
21 lines
| 1 | function downloadCSV(fileName, data) { |
| 2 | const blob = new Blob([data], {type: 'text/csv'}) |
| 3 | const element = window.document.createElement('a') |
| 4 | element.href = window.URL.createObjectURL(blob) |
| 5 | element.download = fileName |
| 6 | document.body.appendChild(element) |
| 7 | element.click() |
| 8 | document.body.removeChild(element) |
| 9 | } |
| 10 | |
| 11 | function downloadJSON(fileName, data) { |
| 12 | const blob = new Blob([data], {type: 'application/json'}) |
| 13 | const element = window.document.createElement('a') |
| 14 | element.href = window.URL.createObjectURL(blob) |
| 15 | element.download = fileName |
| 16 | document.body.appendChild(element) |
| 17 | element.click() |
| 18 | document.body.removeChild(element) |
| 19 | } |
| 20 | |
| 21 | module.exports = {downloadCSV, downloadJSON} |