You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- class Subject {
- constructor() {
- this.observers = [];
- }
- add(observer) {
- this.observers.push(observer);
- }
- remove(observer) {
- this.observers = this.observers.filter((iO) => iO !== observer);
- }
- notify(...args) {
- this.observers.forEach((f) => f(...args));
- }
- }
-
- module.exports.Subject = Subject;
|