word: common language handling in quiz
[sheet.git] / word / quiz.js
index d2a581824d6feb4f271af1524140c720e1eb968d..0518fa14bdbc72c386f1b5abe4554c1f05d30965 100644 (file)
@@ -21,9 +21,8 @@ class Quiz {
                });
        }
 
-       constructor() {
-               this.dataurl = '/data/wordlist.nl.json';
-               fetch(this.dataurl).then(res => res.json()).then(json => {
+       constructor(dataurl) {
+               fetch(dataurl).then(res => res.json()).then(json => {
                        this.form = document.getElementById('quiz');
                        this.words = Object.values(json)
                                .sort(() => {return .5 - Math.random()}) // shuffle
@@ -32,5 +31,3 @@ class Quiz {
                });
        }
 };
-
-new Quiz();