You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2018/03/22 08:09:44 UTC

incubator-weex git commit: [WEEX-262][iOS] Add new interface of Instance, which will terminate render process after bundleJS download finished.

Repository: incubator-weex
Updated Branches:
  refs/heads/master 83d254398 -> 40c6c191a


[WEEX-262][iOS] Add new interface of Instance,which will terminate render process after bundleJS download finished.


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

Branch: refs/heads/master
Commit: 40c6c191aaa83a98fec5243a5d18e0f70f26c956
Parents: 83d2543
Author: boboning <ni...@163.com>
Authored: Thu Mar 22 15:37:14 2018 +0800
Committer: boboning <ni...@163.com>
Committed: Thu Mar 22 15:48:32 2018 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h | 7 +++++++
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 6 ++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/40c6c191/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
index 1d92352..23eae9e 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
@@ -167,6 +167,13 @@ typedef NS_ENUM(NSInteger, WXErrorCode) {//error.code
 @property (nonatomic, copy) void(^onJSDownloadedFinish)(WXResourceResponse *response,WXResourceRequest *request,NSData *data, NSError* error);
 
 /**
+ * The callback triggered when the bundleJS request finished in the renderWithURL. If the callback returns YES, the render process will terminate.
+ * @return A block that takes response which the server response,request which send to server,data which the server returned and an error
+ */
+@property (nonatomic, copy) BOOL (^onRenderTerminateWhenJSDownloadedFinish)(WXResourceResponse *response,WXResourceRequest *request,NSData *data, NSError* error);
+
+
+/**
  *  the frame of current instance.
  **/
 @property (nonatomic, assign) CGRect frame;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/40c6c191/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index e3aafcc..79abbbd 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -320,6 +320,12 @@ typedef enum : NSUInteger {
         WX_MONITOR_SUCCESS_ON_PAGE(WXMTJSDownload, strongSelf.pageName);
         WX_MONITOR_INSTANCE_PERF_END(WXPTJSDownload, strongSelf);
         
+        if (strongSelf.onRenderTerminateWhenJSDownloadedFinish) {
+            if (strongSelf.onRenderTerminateWhenJSDownloadedFinish(response, request, data, error)) {
+                return;
+            }
+        }
+        
         [strongSelf _renderWithMainBundleString:jsBundleString];
         [WXTracingManager setBundleJSType:jsBundleString instanceId:weakSelf.instanceId];
     };