forked from MapComplete/MapComplete
Rename utility function
This commit is contained in:
parent
7278e6491d
commit
269856a002
2 changed files with 2 additions and 2 deletions
2
Utils.ts
2
Utils.ts
|
@ -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);
|
||||||
|
|
|
@ -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")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue