weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acton...@apache.org
Subject [1/3] incubator-weex git commit: + [ios] add timer
Date Wed, 03 May 2017 13:10:33 GMT
Repository: incubator-weex
Updated Branches:
  refs/heads/0.13-dev bb31e8efb -> 73f5dee3a


+ [ios] add timer


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d651a97a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d651a97a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d651a97a

Branch: refs/heads/0.13-dev
Commit: d651a97a0ff6d1bcca0159e6d9510f6341c66e94
Parents: 9381c91
Author: 齐山 <sunjjbobo@163.com>
Authored: Tue Apr 25 00:35:25 2017 +0800
Committer: 齐山 <sunjjbobo@163.com>
Committed: Tue Apr 25 00:35:25 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 23 ++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d651a97a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
index 7d58cf3..1131116 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
@@ -78,7 +78,14 @@
         
         _jsContext[@"setIntervalWeex"] = ^(JSValue *appid, JSValue *ret,JSValue *arg) {
             [weakSelf triggerInterval:[appid toString] ret:[ret toString] arg:[arg toString]];
-            
+        };
+        
+        _jsContext[@"clearIntervalWeex"] = ^(JSValue *appid, JSValue *ret,JSValue *arg) {
+            [weakSelf triggerClearInterval:[appid toString] ret:[ret toString] arg:[arg toString]];
+        };
+        
+        _jsContext[@"clearTimeoutWeex"] = ^(JSValue *appid, JSValue *ret,JSValue *arg) {
+            [weakSelf triggerClearTimeout:[appid toString] ret:[ret toString] arg:[arg toString]];
         };
         
         _jsContext[@"nativeLog"] = ^() {
@@ -282,7 +289,6 @@
         [[WXSDKManager bridgeMgr] callBack:[dic objectForKey:@"appid"] funcId:[dic objectForKey:@"ret"]
 params:nil keepAlive:YES];
         [self triggerInterval:[dic objectForKey:@"appid"] ret:[dic objectForKey:@"ret"] arg:[dic
objectForKey:@"arg"]];
     }
-    
 }
 
 - (void)triggerTimeout:(NSString *)appid ret:(NSString *)ret arg:(NSString *)arg
@@ -324,4 +330,17 @@
     });
 }
 
+- (void)triggerClearInterval:(NSString *)appid ret:(NSString *)ret arg:(NSString *)arg
+{
+    if(![_timers containsObject:appid]){
+        [_timers removeObject:appid];
+    }
+}
+
+- (void)triggerClearTimeout:(NSString *)appid ret:(NSString *)ret arg:(NSString *)arg
+{
+    if(![_timers containsObject:appid]){
+        [_timers removeObject:appid];
+    }
+}
 @end


Mime
View raw message