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
| var Test = Class.create( {
initialize : function(name) {
this.name = name;
},
showMyName : function(pe) {
var goOn = confirm("Mon nom est :'" + this.name + "'\nOn continue ?");
if((! goOn) && (pe)) {
pe.stop();
}
},
timerKO : function() {
new PeriodicalExecuter(this.showMyName, 3);
},
timerOK : function() {
new PeriodicalExecuter(this.showMyName.bindAsEventListener(this), 3);
}
} );
var testOK = new Test("marche");
testOK.timerOK();
var testKO = new Test("marche pas");
testKO.timerKO(); |
Partager