codemirror option for text widgets & danbooru tag autocomplete

This commit is contained in:
space-nuko
2023-05-24 11:47:08 -05:00
parent 6bbd18a261
commit 18c63c9f2e
15 changed files with 100697 additions and 25 deletions

View File

@@ -52,6 +52,14 @@ export function* enumerate<T>(iterable: Iterable<T>): Iterable<[number, T]> {
}
}
export async function timeExecutionMs(fn: (...any) => Promise<any>, ...args: any[]): Promise<number> {
const start = new Date().getTime();
await fn.apply(null, args)
return new Date().getTime() - start;
}
export function download(filename: string, text: string, type: string = "text/plain") {
const blob = new Blob([text], { type: type });
const url = URL.createObjectURL(blob);