mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 10:01:08 +08:00
fix(Utils): dispatchToUIThread
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user