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