From d7e421efc985a063568e1bd974dd1ccfa6ea6455 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 30 Jun 2021 15:37:30 +0200 Subject: [PATCH] Add addCallbackAndRunD which ignores undefeind and null values --- Logic/UIEventSource.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Logic/UIEventSource.ts b/Logic/UIEventSource.ts index 7fa5a432d..d18cec86f 100644 --- a/Logic/UIEventSource.ts +++ b/Logic/UIEventSource.ts @@ -159,4 +159,11 @@ export class UIEventSource { return newSource; } + addCallbackAndRunD(callback: (data :T ) => void) { + this.addCallbackAndRun(data => { + if(data !== undefined && data !== null){ + callback(data) + } + }) + } } \ No newline at end of file