First steps for a decent custom theme generator

This commit is contained in:
Pieter Vander Vennet 2020-08-31 02:59:47 +02:00
parent a57b7d93fa
commit 2052976909
82 changed files with 1880 additions and 1311 deletions

View file

@ -8,17 +8,18 @@ export class UIEventSource<T>{
}
public addCallback(callback: ((latestData : T) => void)) {
public addCallback(callback: ((latestData : T) => void)) : UIEventSource<T>{
this._callbacks.push(callback);
return this;
}
public setData(t: T): void {
public setData(t: T): UIEventSource<T> {
if (this.data === t) {
return;
}
this.data = t;
this.ping();
return this;
}
public ping(): void {
@ -55,7 +56,6 @@ export class UIEventSource<T>{
const update = function () {
newSource.setData(f(self.data));
newSource.ping();
}
this.addCallback(update);