@Test public void testSetTimeout() throws Exception { module.setTimeout(1,2); Mockito.verify(bridge,times(1)).sendMessageDelayed(any(Message.class),eq((long)2)); reset(bridge); module.setTimeout(0,0); Mockito.verify(bridge,never()).sendMessageDelayed(any(Message.class),anyLong()); }
@JSMethod(uiThread = false) public void setTimeout(int funcId, int delay) { if(delay<0){ delay = 0; } if(funcId <= 0){ return; } Message message = Message.obtain(); message.what = WXJSBridgeMsgType.MODULE_TIMEOUT; message.arg1 = Integer.parseInt(mWXSDKInstance.getInstanceId()); message.obj = funcId; WXBridgeManager.getInstance().sendMessageDelayed(message, delay); }
WXTimerModule extends WXModule { @JSMethod(uiThread = false) public void setTimeout(int funcId, int delay) { if(delay<0){ delay = 0; } if(funcId <= 0){ return; } Message message = Message.obtain(); message.what = WXJSBridgeMsgType.MODULE_TIMEOUT; message.arg1 = Integer.parseInt(mWXSDKInstance.getInstanceId()); message.obj = funcId; WXBridgeManager.getInstance().sendMessageDelayed(message, delay); } }
WXTimerModule extends WXModule { @JSMethod(uiThread = false) public void setTimeout(int funcId, int delay) { if(delay<0){ delay = 0; } if(funcId <= 0){ return; } Message message = Message.obtain(); message.what = WXJSBridgeMsgType.MODULE_TIMEOUT; message.arg1 = Integer.parseInt(mWXSDKInstance.getInstanceId()); message.obj = funcId; WXBridgeManager.getInstance().sendMessageDelayed(message, delay); }  }
WXTimerModule extends WXModule { @JSMethod(uiThread = false) public void setTimeout(int funcId, int delay) { if(delay<0){ delay = 0; } if(funcId <= 0){ return; } Message message = Message.obtain(); message.what = WXJSBridgeMsgType.MODULE_TIMEOUT; message.arg1 = Integer.parseInt(mWXSDKInstance.getInstanceId()); message.obj = funcId; WXBridgeManager.getInstance().sendMessageDelayed(message, delay); }  @JSMethod(uiThread = false) void setTimeout(int funcId, int delay); @JSMethod(uiThread = false) void setInterval(int funcId, int interval); @JSMethod(uiThread = false) void clearTimeout(int funcId); @JSMethod(uiThread = false) void clearInterval(int funcId); static void setInterval(int funcId, int interval, int instanceId); }
WXTimerModule extends WXModule { @JSMethod(uiThread = false) public void setTimeout(int funcId, int delay) { if(delay<0){ delay = 0; } if(funcId <= 0){ return; } Message message = Message.obtain(); message.what = WXJSBridgeMsgType.MODULE_TIMEOUT; message.arg1 = Integer.parseInt(mWXSDKInstance.getInstanceId()); message.obj = funcId; WXBridgeManager.getInstance().sendMessageDelayed(message, delay); }  @JSMethod(uiThread = false) void setTimeout(int funcId, int delay); @JSMethod(uiThread = false) void setInterval(int funcId, int interval); @JSMethod(uiThread = false) void clearTimeout(int funcId); @JSMethod(uiThread = false) void clearInterval(int funcId); static void setInterval(int funcId, int interval, int instanceId);  }