* Export state as JSON file
(state)
| 894 | * Export state as JSON file |
| 895 | */ |
| 896 | function exportState(state) { |
| 897 | const dataStr = JSON.stringify(state, null, 2); |
| 898 | const blob = new Blob([dataStr], { type: 'application/json' }); |
| 899 | const url = URL.createObjectURL(blob); |
| 900 | |
| 901 | const link = document.createElement('a'); |
| 902 | link.href = url; |
| 903 | link.download = `unmessify_backup_${formatDate(new Date())}.json`; |
| 904 | link.click(); |
| 905 | |
| 906 | URL.revokeObjectURL(url); |
| 907 | showToast('Data exported successfully!', 'success'); |
| 908 | } |
| 909 | |
| 910 | /** |
| 911 | * Import state from JSON file |
no test coverage detected