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) { export function dispatchToUIThread(func: () => void) {
const runloop = CFRunLoopGetMain(); const runloop = CFRunLoopGetMain();
return function (func) {
if (runloop && func) { if (runloop && func) {
CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, func); CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, func);
CFRunLoopWakeUp(runloop); CFRunLoopWakeUp(runloop);
} else if (func) { } else if (func) {
func(); func();
} }
};
} }