Skip to content

Instantly share code, notes, and snippets.

@intojs
Created November 21, 2020 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save intojs/6e971c1339fce9981911e20d7317ed45 to your computer and use it in GitHub Desktop.
Save intojs/6e971c1339fce9981911e20d7317ed45 to your computer and use it in GitHub Desktop.
React MVC - Observer
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