removed 1 circular dependency

part of #2462
This commit is contained in:
Miodec 2022-02-10 19:34:13 +01:00
parent 744ec677e4
commit 0e967bdc20
2 changed files with 4 additions and 6 deletions

View file

@ -942,7 +942,7 @@ export async function init() {
if (Config.mode == "custom") {
wordList = CustomText.text;
}
const wordset = Wordset.withWords(wordList);
const wordset = Wordset.withWords(wordList, Config.funbox);
if (
(Config.funbox == "wikipedia" || Config.funbox == "poetry") &&
@ -1240,7 +1240,7 @@ export async function addWord() {
.leftToRight,
words: CustomText.text,
};
const wordset = Wordset.withWords(language.words);
const wordset = Wordset.withWords(language.words, Config.funbox);
let randomWord = await getNextWord(wordset, language, bound);

View file

@ -1,5 +1,3 @@
import Config from "../config";
let currentWordset = null;
let currentWordGenerator = null;
@ -88,8 +86,8 @@ class WordGenerator extends Wordset {
}
}
export function withWords(words) {
if (Config.funbox == "pseudolang") {
export function withWords(words, funbox) {
if (funbox == "pseudolang") {
if (currentWordGenerator == null || words !== currentWordGenerator.words) {
currentWordGenerator = new WordGenerator(words);
}