WS: improve Observable implementation

This commit is contained in:
Luciano Iam 2020-06-14 12:18:21 +02:00 committed by Robin Gareus
parent 842b989e19
commit 1369076c14
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
5 changed files with 28 additions and 25 deletions

View file

@ -30,8 +30,12 @@ export class Component extends Observable {
return this._channel;
}
on (property, callback) {
this.addObserver(property, (self) => callback(self[property]));
on (event, callback) {
this.addObserver(event, callback);
}
notify (property) {
this.notifyObservers(property, this['_' + property]);
}
send (node, addr, val) {
@ -48,7 +52,7 @@ export class Component extends Observable {
updateLocal (property, value) {
this['_' + property] = value;
this.notifyObservers(property);
this.notify(property);
}
updateRemote (property, value, node, addr) {