word/quiz: common base class for all subpages
[sheet.git] / word / memory.js
index c3adfd4590d3d7dd6e4edc519620a84b8442b78f..375b7c185bab825ba6eb63b5ea80862952ac6cf0 100644 (file)
@@ -1,4 +1,4 @@
-class WordMemory {
+class WordMemory extends WordQuiz {
        turn(click) {
                let target = click.currentTarget;
                if (!target.classList.contains('turn')) {
@@ -37,7 +37,7 @@ class WordMemory {
                .forEach(card => put(card, '!.turn!.bad'));
        }
 
-       constructor() {
+       load(dataurl) {
                this.dataurl = '/data/wordpairs.json';
                fetch(this.dataurl).then(res => res.json()).then(pairs => {
                        this.turned = [];
@@ -55,5 +55,3 @@ class WordMemory {
                });
        }
 };
-
-new WordMemory();