@Test public void testRemoveEvent() throws Exception { createBody(); JSONObject obj; obj = new JSONObject(); obj.put("type","div"); obj.put("ref","100"); stmt.addDom(obj,WXDomObject.ROOT,0); stmt.removeEvent("100",null); stmt.addEvent("100","click"); stmt.removeEvent("100","click"); stmt.batch(); }
void removeEvent(final String ref, final String type) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); final WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEEVENT); } return; } domObject.removeEvent(type); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { WXComponent comp = mWXRenderManager.getWXComponent(mInstanceId,ref); if(comp != null){ comp.updateDom(domObject); mWXRenderManager.removeEvent(mInstanceId, ref, type); } } @Override public String toString() { return "removeEvent"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
WXDomStatement { void removeEvent(final String ref, final String type) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); final WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEEVENT); } return; } domObject.removeEvent(type); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { WXComponent comp = mWXRenderManager.getWXComponent(mInstanceId,ref); if(comp != null){ comp.updateDom(domObject); mWXRenderManager.removeEvent(mInstanceId, ref, type); } } @Override public String toString() { return "removeEvent"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } } }
WXDomStatement { void removeEvent(final String ref, final String type) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); final WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEEVENT); } return; } domObject.removeEvent(type); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { WXComponent comp = mWXRenderManager.getWXComponent(mInstanceId,ref); if(comp != null){ comp.updateDom(domObject); mWXRenderManager.removeEvent(mInstanceId, ref, type); } } @Override public String toString() { return "removeEvent"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } } WXDomStatement(String instanceId, WXRenderManager renderManager); }
WXDomStatement { void removeEvent(final String ref, final String type) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); final WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEEVENT); } return; } domObject.removeEvent(type); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { WXComponent comp = mWXRenderManager.getWXComponent(mInstanceId,ref); if(comp != null){ comp.updateDom(domObject); mWXRenderManager.removeEvent(mInstanceId, ref, type); } } @Override public String toString() { return "removeEvent"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } } WXDomStatement(String instanceId, WXRenderManager renderManager); void destroy(); void getComponentSize(final String ref, final JSCallback callback); }
WXDomStatement { void removeEvent(final String ref, final String type) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); final WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEEVENT); } return; } domObject.removeEvent(type); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { WXComponent comp = mWXRenderManager.getWXComponent(mInstanceId,ref); if(comp != null){ comp.updateDom(domObject); mWXRenderManager.removeEvent(mInstanceId, ref, type); } } @Override public String toString() { return "removeEvent"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } } WXDomStatement(String instanceId, WXRenderManager renderManager); void destroy(); void getComponentSize(final String ref, final JSCallback callback);  }