handle size of datas

This commit is contained in:
arnaud 2026-03-13 01:40:30 +01:00
parent 4c7737c531
commit 221bc4a1c4

View file

@ -6,6 +6,7 @@
let iNb = 0;
let ok = false;
let hw = null;
let datas_length = 0;
function init(options = {}) {
displayChallenge(
@ -14,6 +15,8 @@
options.datas[iNb].pinyin
);
datas_length = options.datas.length;
// Initialisation du writer
hw = initHW(
options.canvasID,
@ -42,7 +45,7 @@
// success
iNb++;
if (iNb > 9) {
if (iNb >= datas_length) {
document.getElementById(options.feedbackID).textContent = "Fini !";
return -1;
}