forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
0162d52b68
127 changed files with 6609 additions and 15167 deletions
7
Utils.ts
7
Utils.ts
|
@ -358,14 +358,13 @@ export class Utils {
|
|||
|
||||
/**
|
||||
* Triggers a 'download file' popup which will download the contents
|
||||
* @param contents
|
||||
* @param fileName
|
||||
*/
|
||||
public static offerContentsAsDownloadableFile(contents: string | Blob, fileName: string = "download.txt") {
|
||||
public static offerContentsAsDownloadableFile(contents: string | Blob, fileName: string = "download.txt",
|
||||
options?: { mimetype: string }) {
|
||||
const element = document.createElement("a");
|
||||
let file;
|
||||
if (typeof (contents) === "string") {
|
||||
file = new Blob([contents], {type: 'text/plain'});
|
||||
file = new Blob([contents], {type: options?.mimetype ?? 'text/plain'});
|
||||
} else {
|
||||
file = contents;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue