-class WordMemory {
+class WordMemory extends WordQuiz {
turn(click) {
let target = click.currentTarget;
if (!target.classList.contains('turn')) {
// lock both as correct
this.turned.forEach(card => put(card, '.good![onclick]'));
this.turned = [];
+ if (Array.from(this.form.children).every(card => card.classList.contains('good'))) {
+ put(this.form, '.good');
+ }
return;
}
.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 = [];
});
}
};
-
-new WordMemory();