Last active
October 23, 2018 01:30
-
-
Save hndr91/61d85806bc6310752834fd482d66a9ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onGameStart(){ | |
this.ref = setInterval(()=>{ | |
this.incNumberEmitter.emit(this.incNumber + 1); | |
this.incNumber++; | |
}, 1000); | |
} | |
/* Keterangan */ | |
/* | |
1. Pertama kalian harus membuat property ref tanpa assign ke value. | |
Ref digunakan sebagai tempat untuk fungsi setInteval(). Perhatikan baris ke-2 | |
2. Property incNumberEmitter merupakan sebuah even emiiter. Kalian harus menggunakan @Output dan EventEmiiter untuk | |
mendeklarasikan property ini. | |
3. Property incNumber merupakan counter yang diawali dengan nilai 0, | |
dan akan di increment sebanyak 1 setiap interval 1000ms (1s). Perhatikan baris ke-2 sampai ke-5. | |
4. EventEmitter incNumberEmitter akan ditangkap oleh komponen app pada selector game-control | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment