mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
11 lines
319 B
TypeScript
11 lines
319 B
TypeScript
export function dispatchToMainThread(func: () => void) {
|
|
new android.os.Handler(android.os.Looper.getMainLooper())
|
|
.post(new java.lang.Runnable({
|
|
run: func
|
|
}));
|
|
}
|
|
|
|
export function isMainThread(): Boolean {
|
|
return android.os.Looper.myLooper() === android.os.Looper.getMainLooper();
|
|
}
|