ensure that targets are in dictionary

This commit is contained in:
blek 2023-09-03 22:37:52 +10:00
parent 775aa83134
commit 40eac5d01f
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 6 additions and 0 deletions

View File

@ -1,7 +1,12 @@
import targets from "./targets";
let dict: string[] = [];
let dict_loaded = false;
export async function loadDict(onprogress?: {(data: { loaded: number, total: number }): void}) {
if (dict_loaded) return dict;
const req = await fetch('/dictionary.csv', {
cache: 'force-cache'
});
@ -24,6 +29,7 @@ export async function loadDict(onprogress?: {(data: { loaded: number, total: num
}
}))
dict = data.split(',');
dict = [ ...targets, ...dict ];
dict_loaded = true;
}