mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
12 lines
295 B
TypeScript
12 lines
295 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();
|
|
}
|