1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| function stepFunction(args, onFinalStepCalled, onAbort, etape) {
try {
switch (etape) {
case window["@Undefined"]:
case 0:
/* Traitement : 1e étape */
setTimeout(function () {
stepFunction(args, onFinalStepCalled, onAbort, 1)
}, 10000)
return true;
case 1:
/* Test de type 1 : Si faux, patientez */
if (typeof document.getElementById('x') == "undefined") {
setTimeout(function () {
stepFunction(args, onFinalStepCalled, onAbort, 1)
}, 500)
}
/* Traitement : 2e étape */
setTimeout(function () {
stepFunction(args, onFinalStepCalled, onAbort, 2)
}, 10000)
return true;
case 2:
/* Test de type 2 : si faux, stopper le traitement */
if (!document.getElementById('x').firstChild) {
try { onAbort(2, args) } catch (ex) {}
return false;
}
/* Traitement : 3e étape */
try { onFinalStepCalled(2, args) } catch (ex) {}
}
} catch (ex) {
onAbort(etape?etape:0, args);
}
} |
Partager