Created
June 12, 2021 09:27
-
-
Save devrkd/7cb06cd1cd077d484633f94356603cbb to your computer and use it in GitHub Desktop.
Sample Observer 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 DisplayScore implements Observer { | |
update(subject: Score) { | |
console.log('Display score: ' + subject.getScore()); | |
} | |
} | |
class CliScore implements Observer { | |
update(subject: Score) { | |
console.log('CLI score: ' + subject.getScore()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment