feat: added Utils.executeOnUIThread

This commit is contained in:
Nathan Walker
2022-04-25 08:36:20 -07:00
parent 74e42fcb8b
commit 36a55dac7f
7 changed files with 41 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import * as types from './types';
import { dispatchToMainThread, isMainThread } from './mainthread-helper';
import { dispatchToMainThread, dispatchToUIThread, isMainThread } from './mainthread-helper';
import { sanitizeModuleName } from '../ui/builder/module-name-sanitizer';
import * as layout from './layout-helper';
@ -125,6 +125,10 @@ export function executeOnMainThread(func: Function) {
}
}
export function executeOnUIThread(func: Function) {
dispatchToUIThread(func);
}
export function mainThreadify(func: Function): (...args: any[]) => void {
return function (...args) {
const argsToPass = args;