Last active
May 11, 2018 14:29
-
-
Save mmintel/ee300e0a9f943247950b4c60897dec20 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
| export default class Model { | |
| constructor() { | |
| // Speicher alle Beobachter | |
| this.observers = []; | |
| } | |
| // Füge einen neuen Beobachter hinzu | |
| registerObserver(observer) { | |
| this.observers.push(observer); | |
| } | |
| // Informiere alle Beobachter in dem wir die update Methode aufrufen | |
| notifyAll() { | |
| this.observers.forEach((observer) => { | |
| observer.update(this); | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment