September 2018
Intermediate to advanced
328 pages
9h 10m
English
The remaining methods definitions and mounted() event handler function are shown as follows:
... // Looping function to move the spaceship across the canvas. loopRectMotion() { setTimeout(() => { this.instance.moveRect(); if (this.instance.getIsRunning()) this.loopRectMotion(); }, 15 - this.speed); }, // Pauses/resumes the spaceship's movement when the button is // clicked: onActionClick(event) { const newIsRunning = !this.instance.getIsRunning(); this.instance.setIsRunning(newIsRunning); event.target.innerHTML = newIsRunning ? 'Pause' : 'Resume'; if (newIsRunning) this.loopRectMotion(); }},mounted() { this.initializeWasm().then(() => { this.instance.start( this.bounds.width, this.bounds.height, this.rect.width, this.rect.height ...Read now
Unlock full access