You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2018/12/22 03:40:36 UTC
[GitHub] wangguanquan opened a new issue #1954: WXSDKInstance类有必要暴露IWXRenderListener和IWXStatisticsListener两个属性
wangguanquan opened a new issue #1954: WXSDKInstance类有必要暴露IWXRenderListener和IWXStatisticsListener两个属性
URL: https://github.com/apache/incubator-weex/issues/1954
RT:
mRenderListener和mStatisticsListener两个属性都没有get方法,如果要对线上项目监听加逻辑需要打开每个类然后添加相同逻辑,比较麻烦并且容易出错
如果暴露了get方法可以在一个类进行包装,原逻辑不需要修改。
```
WXSDKInstance wxsdkInstance = WXSDKManager.getInstance().getSDKInstance(instanceId)
if (wxsdkInstance != null) {
// get rander listener
final IWXRenderListener listener = wxsdkInstance.getRenderListener(); // TODO
// wrapper listener
if (listener != null) {
wxsdkInstance.registerRenderListener(new WXRenderListenerWrapper(listener));
} else {
wxsdkInstance.registerRenderListener(new WXRenderListenerWrapper());
}
}
WXRenderListenerWrapper implements IWXRenderListener {
@Override public void onException(WXSDKInstance instance, String errCode, String msg) {
if (listener != null) {
listener.onException(instance, errCode, msg);
}
// do ...
}
....
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services