Closed xparagon closed 1 year ago
ChatGPT suggest this:
async function saveFile() {
const fileContent = 'Flip \n' + ((new Date()).toDateString()) + '\n' + words.length + ' words\n\n\n';
let exportedWords = '';
words.forEach(line => {
if (!(line.word === '' || line.meaning === '')) {
exportedWords += line.word + '\n' + line.meaning + '\n\n';
}
});
const fileContent = fileContent + exportedWords + '\n\nhttps://flip.fred.technology/\n' + '\n\nhttps://sprakverksted.no/\n';
const blob = new Blob([fileContent], {type: 'text/plain'});
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = 'Flip - ' + ((new Date()).toDateString()) + '.txt';
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
a.remove();
setMessage(labels.msgSaved.at(language - 1) as string);
}
thank you GPT!
On a PC there is no problem