Last active
February 19, 2019 08:00
-
-
Save summerscar/0eaa5866a8b9f9096c8ccd3c20f472dc to your computer and use it in GitHub Desktop.
Revisions
-
summerscar revised this gist
Feb 19, 2019 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,4 +13,12 @@ function exportData(text) { saveLink.click() window.URL.revokeObjectURL(url) document.body.removeChild(saveLink) } dom.change =function(e) { const reader = new FileReader(); reader.onload = function() { console.log(reader.result) } reader.readAsText(e.target.files[0]); } -
summerscar created this gist
Feb 19, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ function exportData(text) { const saveLink = document.createElement('a') document.body.appendChild(saveLink) const data = new Blob([text], { type: 'text' }) const url = window.URL.createObjectURL(data) saveLink.href = url // File name: project-DATE-TIME const date = new Date() const timestamp = `${date.toLocaleDateString()}-${date.toLocaleTimeString()}` saveLink.download = `block.${timestamp}.svg` saveLink.click() window.URL.revokeObjectURL(url) document.body.removeChild(saveLink) }