class App_20200916205822 { constructor( canvasId ) { this.cc = document.getElementById( canvasId ).getContext( "2d" ); this.flg = true; //Appli } start() { this.timerId = setInterval( function() { this.draw( this.cc ); this.flg = ! this.flg; }.bind( this ), 500 ); } stop() { clearInterval( this.timerId ); } draw( cc ) { cc.fillStyle = this.flg ? "red" : "blue"; cc.fillRect( 30, 30, 130, 130 ); } } class Test_20200916205822 { constructor() { } }