Add addCallbackAndRunD which ignores undefeind and null values

This commit is contained in:
pietervdvn 2021-06-30 15:37:30 +02:00
parent 5e84b00ca2
commit d7e421efc9

View file

@ -159,4 +159,11 @@ export class UIEventSource<T> {
return newSource; return newSource;
} }
addCallbackAndRunD(callback: (data :T ) => void) {
this.addCallbackAndRun(data => {
if(data !== undefined && data !== null){
callback(data)
}
})
}
} }