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