Created
June 12, 2021 09:23
-
-
Save devrkd/9681b9b86f27689b59911393053a38c7 to your computer and use it in GitHub Desktop.
Example Observable class in typescript
This file contains 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
class Score extends Subject { | |
private score: number; | |
public updateScore(score: number) | |
{ | |
this.score = score; | |
console.log('got new score.....'); | |
this.notify(); | |
} | |
public getScore() { | |
return this.score; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment