use of com.taobao.weex.ui.module.WXTimerModule in project weex-example by KalicyZhou.
the class WXModuleManager method callModuleMethod.
static Object callModuleMethod(final String instanceId, String moduleStr, String methodStr, JSONArray args) {
ModuleFactory factory = sModuleFactoryMap.get(moduleStr);
if (factory == null) {
WXLogUtils.e("[WXModuleManager] module factory not found.");
return null;
}
final WXModule wxModule = findModule(instanceId, moduleStr, factory);
if (wxModule == null) {
return null;
}
WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId);
wxModule.mWXSDKInstance = instance;
final Invoker invoker = factory.getMethodInvoker(methodStr);
try {
return instance.getNativeInvokeHelper().invoke(wxModule, invoker, args);
} catch (Exception e) {
WXLogUtils.e("callModuleMethod >>> invoke module:" + moduleStr + ", method:" + methodStr + " failed. ", e);
return null;
} finally {
if (wxModule instanceof WXDomModule || wxModule instanceof WXTimerModule) {
wxModule.mWXSDKInstance = null;
}
}
}
Aggregations