handle size of datas
This commit is contained in:
parent
4c7737c531
commit
221bc4a1c4
1 changed files with 4 additions and 1 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue