WXDomStatement { void removeEvent(final String ref, final String type) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); 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() { 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(); static final String CHILDREN; static final String TYPE; }
@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(); }