Rename utility function

This commit is contained in:
Pieter Vander Vennet 2021-05-31 00:20:15 +02:00
parent 7278e6491d
commit 269856a002
2 changed files with 2 additions and 2 deletions

View file

@ -301,7 +301,7 @@ export class Utils {
* @param contents * @param contents
* @param fileName * @param fileName
*/ */
public static downloadTxtFile(contents: string, fileName: string = "download.txt") { public static offerContentsAsDownloadableFile(contents: string, fileName: string = "download.txt") {
const element = document.createElement("a"); const element = document.createElement("a");
const file = new Blob([contents], {type: 'text/plain'}); const file = new Blob([contents], {type: 'text/plain'});
element.href = URL.createObjectURL(file); element.href = URL.createObjectURL(file);

View file

@ -89,7 +89,7 @@ function clearAll(preferences){
function SalvageButton(theme: { themeName: string, contents: string }) { function SalvageButton(theme: { themeName: string, contents: string }) {
return new SubtleButton("./assets/svg/bug.svg", "Download broken theme " + theme.themeName).onClick( return new SubtleButton("./assets/svg/bug.svg", "Download broken theme " + theme.themeName).onClick(
() => { () => {
Utils.downloadTxtFile(theme.contents, theme.themeName + ".json") Utils.offerContentsAsDownloadableFile(theme.contents, theme.themeName + ".json")
} }
) )
} }