| 116 | |
| 117 | // Save the db to a file |
| 118 | function savedb () { |
| 119 | worker.onmessage = function(event) { |
| 120 | toc("Exporting the database"); |
| 121 | var arraybuff = event.data.buffer; |
| 122 | var blob = new Blob([arraybuff]); |
| 123 | var a = document.createElement("a"); |
| 124 | a.href = window.URL.createObjectURL(blob); |
| 125 | a.download = "sql.db"; |
| 126 | a.onclick = function() { |
| 127 | setTimeout(function() { |
| 128 | window.URL.revokeObjectURL(a.href); |
| 129 | }, 1500); |
| 130 | }; |
| 131 | a.click(); |
| 132 | }; |
| 133 | tic(); |
| 134 | worker.postMessage({action:'export'}); |
| 135 | } |
| 136 | savedbElm.addEventListener("click", savedb, true); |