Created
November 21, 2020 00:33
-
-
Save intojs/6e971c1339fce9981911e20d7317ed45 to your computer and use it in GitHub Desktop.
React MVC - Observer
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 Observer { | |
#subject; | |
constructor(subject) { | |
this.#subject = subject; | |
} | |
update(changedSubject) { | |
if (changedSubject === this.#subject) { | |
console.log("Updated"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment