fix(Utils): dispatchToUIThread

This commit is contained in:
Nathan Walker
2022-05-13 23:00:48 -07:00
parent 80e6b8130a
commit 9089b2cf87

View File

@ -8,12 +8,10 @@ export function isMainThread(): boolean {
export function dispatchToUIThread(func: () => void) {
const runloop = CFRunLoopGetMain();
return function (func) {
if (runloop && func) {
CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, func);
CFRunLoopWakeUp(runloop);
} else if (func) {
func();
}
};
if (runloop && func) {
CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, func);
CFRunLoopWakeUp(runloop);
} else if (func) {
func();
}
}