You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ji...@apache.org on 2017/02/20 06:41:00 UTC

[11/50] [abbrv] incubator-weex git commit: V0.10.0 stable gitlab (#178)

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m b/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m
new file mode 100644
index 0000000..24609ac
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m
@@ -0,0 +1,174 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+#import "WXResourceLoader.h"
+#import "WXResourceRequestHandler.h"
+#import "WXSDKInstance.h"
+#import "WXLog.h"
+#import "WXHandlerFactory.h"
+#import "WXSDKError.h"
+
+//deprecated
+#import "WXNetworkProtocol.h"
+
+@interface WXResourceLoader () <WXResourceRequestDelegate>
+
+@end
+
+@implementation WXResourceLoader
+{
+    NSMutableData *_data;
+    WXResourceResponse *_response;
+}
+
+- (instancetype)initWithRequest:(WXResourceRequest *)request
+{
+    if (self = [super init]) {
+        self.request = request;
+    }
+    
+    return self;
+}
+
+- (void)setRequest:(WXResourceRequest *)request
+{
+    if (_request) {
+        [self cancel:nil];
+    }
+    
+    _request = request;
+}
+
+- (void)start
+{
+    if ([_request.URL isFileURL]) {
+        [self _handleFileURL:_request.URL];
+        return;
+    }
+    
+    id<WXResourceRequestHandler> requestHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXResourceRequestHandler)];
+    if (requestHandler) {
+        [requestHandler sendRequest:_request withDelegate:self];
+    } else if ([WXHandlerFactory handlerForProtocol:NSProtocolFromString(@"WXNetworkProtocol")]){
+        // deprecated logic
+        [self _handleDEPRECATEDNetworkHandler];
+    } else {
+        WXLogError(@"No resource request handler found!");
+    }
+}
+
+- (void)cancel:(NSError *__autoreleasing *)error
+{
+    id<WXResourceRequestHandler> requestHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXResourceRequestHandler)];
+    if ([requestHandler respondsToSelector:@selector(cancelRequest:)]) {
+        [requestHandler cancelRequest:_request];
+    } else if (error) {
+        *error = [NSError errorWithDomain:WX_ERROR_DOMAIN code:WX_ERR_CANCEL userInfo:@{NSLocalizedDescriptionKey: @"handle:%@ not respond to cancelRequest"}];
+    }
+}
+
+- (void)_handleFileURL:(NSURL *)url
+{
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        NSData *fileData = [[NSFileManager defaultManager] contentsAtPath:[url path]];
+        if (self.onFinished) {
+            self.onFinished([WXResourceResponse new], fileData);
+        }
+    });
+}
+
+- (void)_handleDEPRECATEDNetworkHandler
+{
+    WXLogWarning(@"WXNetworkProtocol is deprecated, use WXResourceRequestHandler instead!");
+    id networkHandler = [WXHandlerFactory handlerForProtocol:NSProtocolFromString(@"WXNetworkProtocol")];
+    __weak typeof(self) weakSelf = self;
+    [networkHandler sendRequest:_request withSendingData:^(int64_t bytesSent, int64_t totalBytes) {
+        if (weakSelf.onDataSent) {
+            weakSelf.onDataSent(bytesSent, totalBytes);
+        }
+    } withResponse:^(NSURLResponse *response) {
+        _response = (WXResourceResponse *)response;
+        if (weakSelf.onResponseReceived) {
+            weakSelf.onResponseReceived((WXResourceResponse *)response);
+        }
+    } withReceiveData:^(NSData *data) {
+        if (weakSelf.onDataReceived) {
+            weakSelf.onDataReceived(data);
+        }
+    } withCompeletion:^(NSData *totalData, NSError *error) {
+        if (error) {
+            if (weakSelf.onFailed) {
+                weakSelf.onFailed(error);
+            }
+        } else {
+            weakSelf.onFinished(_response, totalData);
+            _response = nil;
+        }
+    }];
+}
+
+#pragma mark - WXResourceRequestDelegate
+
+- (void)request:(WXResourceRequest *)request didSendData:(unsigned long long)bytesSent totalBytesToBeSent:(unsigned long long)totalBytesToBeSent
+{
+    WXLogDebug(@"request:%@ didSendData:%llu totalBytesToBeSent:%llu", request, bytesSent, totalBytesToBeSent);
+    
+    if (self.onDataSent) {
+        self.onDataSent(bytesSent, totalBytesToBeSent);
+    }
+}
+
+- (void)request:(WXResourceRequest *)request didReceiveResponse:(WXResourceResponse *)response
+{
+    WXLogDebug(@"request:%@ didReceiveResponse:%@ ", request, response);
+    
+    _response = response;
+    
+    if (self.onResponseReceived) {
+        self.onResponseReceived(response);
+    }
+}
+
+- (void)request:(WXResourceRequest *)request didReceiveData:(NSData *)data
+{
+    WXLogDebug(@"request:%@ didReceiveDataLength:%ld", request, (unsigned long)data.length);
+    
+    if (!_data) {
+        _data = [NSMutableData new];
+    }
+    [_data appendData:data];
+    
+    if (self.onDataReceived) {
+        self.onDataReceived(data);
+    }
+}
+
+- (void)requestDidFinishLoading:(WXResourceRequest *)request
+{
+    WXLogDebug(@"request:%@ requestDidFinishLoading", request);
+    
+    if (self.onFinished) {
+        self.onFinished(_response, _data);
+    }
+    
+    _data = nil;
+    _response = nil;
+}
+
+- (void)request:(WXResourceRequest *)request didFailWithError:(NSError *)error
+{
+    WXLogDebug(@"request:%@ didFailWithError:%@", request, error.localizedDescription);
+    
+    if (self.onFailed) {
+        self.onFailed(error);
+    }
+    
+    _data = nil;
+    _response = nil;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Loader/WXWebSocketLoader.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Loader/WXWebSocketLoader.h b/ios/sdk/WeexSDK/Sources/Loader/WXWebSocketLoader.h
new file mode 100644
index 0000000..81e8514
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Loader/WXWebSocketLoader.h
@@ -0,0 +1,24 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+
+@interface WXWebSocketLoader : NSObject<NSCopying>
+
+@property (nonatomic, copy) void (^onOpen)();
+@property (nonatomic, copy) void (^onReceiveMessage)(id);
+@property (nonatomic, copy) void (^onClose)(NSInteger,NSString *,BOOL);
+@property (nonatomic, copy) void (^onFail)(NSError *);
+
+- (instancetype)initWithUrl:(NSString *)url protocol:(NSString *)protocol;
+- (void)open;
+- (void)send:(NSString *)data;
+- (void)close;
+- (void)close:(NSInteger)code reason:(NSString *)reason;
+- (void)clear;
+@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Loader/WXWebSocketLoader.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Loader/WXWebSocketLoader.m b/ios/sdk/WeexSDK/Sources/Loader/WXWebSocketLoader.m
new file mode 100644
index 0000000..16b1e9a
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Loader/WXWebSocketLoader.m
@@ -0,0 +1,131 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXWebSocketLoader.h"
+#import "WXWebSocketHandler.h"
+#import "WXHandlerFactory.h"
+#import "WXLog.h"
+
+@interface WXWebSocketLoader () <WXWebSocketDelegate>
+@property (nonatomic, copy) NSString *identifier;
+@property (nonatomic, copy) NSString *url;
+@property (nonatomic, copy) NSString *protocol;
+@end
+
+@implementation WXWebSocketLoader
+
+- (instancetype)initWithUrl:(NSString *)url protocol:(NSString *)protocol
+{
+    if (self = [super init]) {
+        self.url = url;
+        self.protocol = protocol;
+    }
+    return self;
+}
+
+-(id)copyWithZone:(NSZone *)zone {
+    
+    WXWebSocketLoader *newClass = [[WXWebSocketLoader alloc]init];
+    newClass.onOpen = self.onOpen;
+    newClass.onReceiveMessage = self.onReceiveMessage;
+    newClass.onFail = self.onFail;
+    newClass.onClose = self.onClose;
+    newClass.protocol = self.protocol;
+    newClass.url = self.url;
+    newClass.identifier = self.identifier;
+    return newClass;
+}
+
+-(NSString *)identifier
+{
+    if(!_identifier)
+    {
+        CFUUIDRef uuid = CFUUIDCreate(NULL);
+        _identifier = CFBridgingRelease(CFUUIDCreateString(NULL, uuid));
+        assert(_identifier);
+        CFRelease(uuid);
+    }
+    return _identifier;
+}
+
+- (void)open
+{
+    id<WXWebSocketHandler> requestHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXWebSocketHandler)];
+    if (requestHandler) {
+        [requestHandler open:self.url protocol:self.protocol identifier:self.identifier withDelegate:self];
+    } else {
+        WXLogError(@"No resource request handler found!");
+    }
+}
+
+- (void)send:(NSString *)data
+{
+    id<WXWebSocketHandler> requestHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXWebSocketHandler)];
+    if (requestHandler) {
+        [requestHandler send:self.identifier data:data];
+    } else {
+        WXLogError(@"No resource request handler found!");
+    }
+}
+
+- (void)close
+{
+    id<WXWebSocketHandler> requestHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXWebSocketHandler)];
+    if (requestHandler) {
+        [requestHandler close:self.identifier];
+    } else {
+        WXLogError(@"No resource request handler found!");
+    }
+}
+
+- (void)clear
+{
+    id<WXWebSocketHandler> requestHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXWebSocketHandler)];
+    if (requestHandler) {
+        [requestHandler clear:self.identifier];
+    } else {
+        WXLogError(@"No resource request handler found!");
+    }
+}
+
+- (void)close:(NSInteger)code reason:(NSString *)reason
+{
+    id<WXWebSocketHandler> requestHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXWebSocketHandler)];
+    if (requestHandler) {
+        [requestHandler close:self.identifier code:code reason:reason];
+    } else {
+        WXLogError(@"No resource request handler found!");
+    }
+}
+
+#pragma mark - WXWebSocketDelegate
+- (void)didOpen
+{
+    if (self.onOpen) {
+        self.onOpen();
+    }
+}
+- (void)didFailWithError:(NSError *)error
+{
+    if(self.onFail) {
+        self.onFail(error);
+    }
+}
+- (void)didReceiveMessage:(id)message
+{
+    if (self.onReceiveMessage) {
+        self.onReceiveMessage(message);
+    }
+}
+- (void)didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
+{
+    if (self.onClose) {
+        self.onClose(code,reason,wasClean);
+    }
+}
+@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.h b/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.h
index 8576d35..81a63fe 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.h
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.h
@@ -68,10 +68,28 @@
 - (void)executeJsFramework:(NSString *)script;
 
 /**
- *  Execute JS Method
- *  @param method    :   object of bridge method
+ *  Register JS service Script
+ *  @param name      :   service name
+ *  @param script    :   script code
+ *  @param options   :   service options
+ **/
+- (void)registerService:(NSString *)name withService:(NSString *)serviceScript withOptions:(NSDictionary *)options;
+
+
+/**
+ *  Register JS service Script
+ *  @param name         :   service name
+ *  @param scriptUrl    :   script url
+ *  @param options      :   service options
+ **/
+
+-(void)registerService:(NSString *)name withServiceUrl:(NSURL *)serviceScriptUrl withOptions:(NSDictionary *)options;
+
+/**
+ *  Unregister JS service Script
+ *  @param script    :   script code
  **/
-- (void)executeJsMethod:(WXBridgeMethod *)method;
+- (void)unregisterService:(NSString *)name;
 
 /**
  *  Register Modules Method
@@ -85,8 +103,6 @@
  **/
 - (void)registerComponents:(NSArray* )components;
 
-- (void)fireEvent:(NSString *)instanceId ref:(NSString *)ref type:(NSString *)type params:(NSDictionary *)params DEPRECATED_MSG_ATTRIBUTE("Use fireEvent:ref:type:params:domChanges: method instead.");
-
 /**
  *  FireEvent
  *  @param instanceId:   instance id
@@ -139,4 +155,7 @@
  **/
 - (void)resetEnvironment;
 
+- (void)fireEvent:(NSString *)instanceId ref:(NSString *)ref type:(NSString *)type params:(NSDictionary *)params DEPRECATED_MSG_ATTRIBUTE("Use fireEvent:ref:type:params:domChanges: method instead.");
+- (void)executeJsMethod:(WXBridgeMethod *)method DEPRECATED_MSG_ATTRIBUTE();
+
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m
index 6fb2ac0..8d181b5 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m
@@ -11,6 +11,11 @@
 #import "WXLog.h"
 #import "WXAssert.h"
 #import "WXBridgeMethod.h"
+#import "WXCallJSMethod.h"
+#import "WXSDKManager.h"
+#import "WXServiceFactory.h"
+#import "WXResourceRequest.h"
+#import "WXResourceLoader.h"
 
 @interface WXBridgeManager ()
 
@@ -74,6 +79,7 @@ static NSThread *WXBridgeThread;
 {
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
+        
         WXBridgeThread = [[NSThread alloc] initWithTarget:[[self class]sharedManager] selector:@selector(_runLoopThread) object:nil];
         [WXBridgeThread setName:WX_BRIDGE_THREAD_NAME];
         if(WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
@@ -188,7 +194,7 @@ void WXPerformBlockOnBridgeThread(void (^block)())
     });
 }
 
-- (void)executeJsMethod:(WXBridgeMethod *)method
+- (void)callJsMethod:(WXCallJSMethod *)method
 {
     if (!method) return;
     
@@ -198,6 +204,49 @@ void WXPerformBlockOnBridgeThread(void (^block)())
     });
 }
 
+-(void)registerService:(NSString *)name withServiceUrl:(NSURL *)serviceScriptUrl withOptions:(NSDictionary *)options
+{
+    if (!name || !serviceScriptUrl || !options) return;
+    __weak typeof(self) weakSelf = self;
+    WXResourceRequest *request = [WXResourceRequest requestWithURL:serviceScriptUrl resourceType:WXResourceTypeServiceBundle referrer:@"" cachePolicy:NSURLRequestUseProtocolCachePolicy];
+    WXResourceLoader *serviceBundleLoader = [[WXResourceLoader alloc] initWithRequest:request];;
+    serviceBundleLoader.onFinished = ^(WXResourceResponse *response, NSData *data) {
+        __strong typeof(weakSelf) strongSelf = weakSelf;
+        NSString *jsServiceString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+        [strongSelf registerService:name withService:jsServiceString withOptions:options];
+    };
+    
+    serviceBundleLoader.onFailed = ^(NSError *loadError) {
+        WXLogError(@"No script URL found");
+    };
+    
+    [serviceBundleLoader start];
+}
+
+- (void)registerService:(NSString *)name withService:(NSString *)serviceScript withOptions:(NSDictionary *)options
+{
+    if (!name || !serviceScript || !options) return;
+    
+    NSString *script = [WXServiceFactory registerServiceScript:name withRawScript:serviceScript withOptions:options];
+    
+    __weak typeof(self) weakSelf = self;
+    WXPerformBlockOnBridgeThread(^(){
+        [weakSelf.bridgeCtx executeJsService:script withName:name];
+    });
+}
+
+- (void)unregisterService:(NSString *)name
+{
+    if (!name) return;
+    
+    NSString *script = [WXServiceFactory unregisterServiceScript:name];
+    
+    __weak typeof(self) weakSelf = self;
+    WXPerformBlockOnBridgeThread(^(){
+        [weakSelf.bridgeCtx executeJsService:script withName:name];
+    });
+}
+
 - (void)registerModules:(NSDictionary *)modules
 {
     if (!modules) return;
@@ -231,28 +280,24 @@ void WXPerformBlockOnBridgeThread(void (^block)())
     }
     
     NSArray *args = @[ref, type, params?:@{}, domChanges?:@{}];
-    NSMutableDictionary *methodDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
-                                       @"fireEvent", @"method",
-                                       args, @"args", nil];
-    WXBridgeMethod *method = [[WXBridgeMethod alloc] initWithInstance:instanceId data:methodDict];
-    [self executeJsMethod:method];
+    WXSDKInstance *instance = [WXSDKManager instanceForID:instanceId];
+    
+    WXCallJSMethod *method = [[WXCallJSMethod alloc] initWithModuleName:nil methodName:@"fireEvent" arguments:args instance:instance];
+    [self callJsMethod:method];
 }
 
-- (void)callBack:(NSString *)instanceId funcId:(NSString *)funcId params:(id)params keepAlive:(BOOL)keepAlive {
+- (void)callBack:(NSString *)instanceId funcId:(NSString *)funcId params:(id)params keepAlive:(BOOL)keepAlive
+{
     NSArray *args = nil;
     if (keepAlive) {
         args = @[[funcId copy], params? [params copy]:@"\"{}\"", @true];
     }else {
         args = @[[funcId copy], params? [params copy]:@"\"{}\""];
     }
-    NSMutableDictionary *methodDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
-                                       @"callback", @"method",
-                                       @"jsBridge",@"module",
-                                       args, @"args", nil];
-    
-    WXBridgeMethod *method = [[WXBridgeMethod alloc] initWithInstance:instanceId data:methodDict];
-    
-    [self executeJsMethod:method];
+    WXSDKInstance *instance = [WXSDKManager instanceForID:instanceId];
+
+    WXCallJSMethod *method = [[WXCallJSMethod alloc] initWithModuleName:@"jsBridge" methodName:@"callback" arguments:args instance:instance];
+    [self callJsMethod:method];
 }
 
 - (void)callBack:(NSString *)instanceId funcId:(NSString *)funcId params:(id)params
@@ -290,4 +335,16 @@ void WXPerformBlockOnBridgeThread(void (^block)())
     });
 }
 
+#pragma mark - Deprecated
+
+- (void)executeJsMethod:(WXCallJSMethod *)method
+{
+    if (!method) return;
+    
+    __weak typeof(self) weakSelf = self;
+    WXPerformBlockOnBridgeThread(^(){
+        [weakSelf.bridgeCtx executeJsMethod:method];
+    });
+}
+
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXComponentFactory.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentFactory.m b/ios/sdk/WeexSDK/Sources/Manager/WXComponentFactory.m
index 8c55cdf..d3c972a 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentFactory.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentFactory.m
@@ -117,7 +117,7 @@
     void (^mBlock)(id, id, BOOL *) = ^(id mKey, id mObj, BOOL * mStop) {
         [methods addObject:mKey];
     };
-    [config.methods enumerateKeysAndObjectsUsingBlock:mBlock];
+    [config.asyncMethods enumerateKeysAndObjectsUsingBlock:mBlock];
     [_configLock unlock];
     
     return dict;
@@ -132,8 +132,8 @@
     
     [_configLock lock];
     config = [_componentConfigs objectForKey:name];
-    if (config.methods) {
-        selStr = [config.methods objectForKey:method];
+    if (config.asyncMethods) {
+        selStr = [config.asyncMethods objectForKey:method];
     }
     if (selStr) {
         selector = NSSelectorFromString(selStr);

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h
index 1afb054..b02a18b 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h
@@ -87,6 +87,16 @@ extern void WXPerformBlockOnComponentThread(void (^block)());
  **/
 - (void)updateStyles:(NSDictionary *)styles forComponent:(NSString *)ref;
 
+///--------------------------------------
+/// @name Updating pseudo class
+///--------------------------------------
+
+/**
+ * @abstract update  pseudo class styles
+ **/
+
+- (void)updatePseudoClassStyles:(NSDictionary *)styles forComponent:(NSString *)ref;
+
 /**
  * @abstract update attributes
  **/
@@ -107,8 +117,6 @@ extern void WXPerformBlockOnComponentThread(void (^block)());
  **/
 - (void)scrollToComponent:(NSString *)ref options:(NSDictionary *)options;
 
-- (void)dispatchComponentMethod:(WXBridgeMethod*)method;
-
 ///--------------------------------------
 /// @name Life Cycle
 ///--------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
index e292c63..65f6e69 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
@@ -273,6 +273,21 @@ static css_node_t * rootNodeGetChild(void *context, int i)
         }
         [component removeFromSuperview];
     }];
+    
+    [self _checkFixedSubcomponentToRemove:component];
+}
+
+- (void)_checkFixedSubcomponentToRemove:(WXComponent *)component
+{
+    for (WXComponent *subcomponent in component.subcomponents) {
+        if (subcomponent->_positionType == WXPositionTypeFixed) {
+             [self _addUITask:^{
+                 [subcomponent removeFromSuperview];
+             }];
+        }
+        
+        [self _checkFixedSubcomponentToRemove:subcomponent];
+    }
 }
 
 - (WXComponent *)componentForRef:(NSString *)ref
@@ -301,7 +316,7 @@ static css_node_t * rootNodeGetChild(void *context, int i)
     NSDictionary *styles = data[@"style"];
     NSDictionary *attributes = data[@"attr"];
     NSArray *events = data[@"event"];
-    
+        
     Class clazz = [WXComponentFactory classWithComponentName:type];
     WXComponent *component = [[clazz alloc] initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:self.weexInstance];
     WXAssert(component, @"Component build failed for data:%@", data);
@@ -338,6 +353,16 @@ static css_node_t * rootNodeGetChild(void *context, int i)
 
 - (void)updateStyles:(NSDictionary *)styles forComponent:(NSString *)ref
 {
+    [self handleStyles:styles forComponent:ref isUpdateStyles:YES];
+}
+
+- (void)updatePseudoClassStyles:(NSDictionary *)styles forComponent:(NSString *)ref
+{
+    [self handleStyles:styles forComponent:ref isUpdateStyles:NO];
+}
+
+- (void)handleStyles:(NSDictionary *)styles forComponent:(NSString *)ref isUpdateStyles:(BOOL)isUpdateStyles
+{
     WXAssertParam(styles);
     WXAssertParam(ref);
     
@@ -347,9 +372,10 @@ static css_node_t * rootNodeGetChild(void *context, int i)
     NSMutableDictionary *normalStyles = [NSMutableDictionary new];
     NSMutableArray *resetStyles = [NSMutableArray new];
     [self filterStyles:styles normalStyles:normalStyles resetStyles:resetStyles];
-    [component _updateStylesOnComponentThread:normalStyles resetStyles:resetStyles];
+    [component _updateStylesOnComponentThread:normalStyles resetStyles:resetStyles isUpdateStyles:isUpdateStyles];
     [self _addUITask:^{
         [component _updateStylesOnMainThread:normalStyles resetStyles:resetStyles];
+        [component readyToRender];
     }];
 }
 
@@ -364,6 +390,7 @@ static css_node_t * rootNodeGetChild(void *context, int i)
     [component _updateAttributesOnComponentThread:attributes];
     [self _addUITask:^{
         [component _updateAttributesOnMainThread:attributes];
+        [component readyToRender];
     }];
 }
 
@@ -419,33 +446,6 @@ static css_node_t * rootNodeGetChild(void *context, int i)
     }];
 }
 
-- (void)dispatchComponentMethod:(WXBridgeMethod *)method
-{
-    if (!method) {
-        return;
-    }
-    Class componentClazz = [WXComponentFactory classWithComponentName:method.targets[@"component"]];
-    if (!componentClazz) {
-        NSString *errorMessage = [NSString stringWithFormat:@"Module\uff1a%@ doesn't exist\uff01", method.module];
-        WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
-        return;
-    }
-    WXPerformBlockOnComponentThread(^{
-        WXSDKInstance *weexInstance = [WXSDKManager instanceForID:method.instance];
-        WXComponent *componentInstance = [weexInstance componentForRef:method.targets[@"ref"]];
-        
-        [self _executeComponentMethod:componentInstance withMethod:method];
-    });
-}
-
-- (void)_executeComponentMethod:(id)target withMethod:(WXBridgeMethod*)method
-{
-    NSInvocation * invocation = [[WXInvocationConfig sharedInstance] invocationWithTargetMethod:target method:method];
-    WXPerformBlockOnMainThread(^{
-        [invocation invoke];
-    });
-}
-
 #pragma mark Life Cycle
 
 - (void)createFinish
@@ -462,7 +462,6 @@ static css_node_t * rootNodeGetChild(void *context, int i)
         WX_MONITOR_SUCCESS(WXMTNativeRender);
         
         if(instance.renderFinish){
-            [instance creatFinish];
             instance.renderFinish(rootView);
         }
     }];

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.h b/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.h
index 086c411..5f7e4c9 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.h
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.h
@@ -19,7 +19,6 @@
 
 -(void)show;
 -(void)hide;
--(void)configDatePicker:(NSDictionary *)attributes;
 -(void)updateDatePicker:(NSDictionary *)attributes;
 
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.m
index 4fa8d20..78c0697 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXDatePickerManager.m
@@ -63,72 +63,16 @@
         [self.datePickerView addSubview:datePicker];
         [self.datePickerView addSubview:toolBar];
         [self.backgroudView addSubview:self.datePickerView];
-        
     }
     return self;
 }
 
--(void)configDatePicker:(NSDictionary *)attributes
-{
-    NSString *type = [WXConvert NSString:attributes[@"type"]];
-    if(type)
-    {
-        _type = type;
-        if( [type isEqualToString:@"date"])
-        {
-            self.datePicker.datePickerMode = UIDatePickerModeDate;
-            NSString *value = [WXConvert NSString:attributes[@"value"]];
-            if(value)
-            {
-                NSDate *date = [WXUtility dateStringToDate:value];
-                if(date)
-                {
-                    self.datePicker.date =date;
-                }
-            }
-            NSString *max = [WXConvert NSString:attributes[@"max"]];
-            if(max)
-            {
-                NSDate *date = [WXUtility dateStringToDate:max];
-                if(date)
-                {
-                    self.datePicker.maximumDate =date;
-                }
-            }
-            NSString *min = [WXConvert NSString:attributes[@"min"]];
-            if(min)
-            {
-                NSDate *date = [WXUtility dateStringToDate:min];
-                if(date)
-                {
-                    self.datePicker.minimumDate =date;
-                }
-            }
-        }else if([type isEqualToString:@"time"])
-        {
-            self.datePicker.datePickerMode = UIDatePickerModeTime;
-            NSString *value = [WXConvert NSString:attributes[@"value"]];
-            if(value)
-            {
-                NSDate *date = [WXUtility timeStringToDate:value];
-                if(date)
-                {
-                    self.datePicker.date = date;
-                }
-            }
-        }
-    }
-}
-
--(void)updateDatePicker:(NSDictionary *)attributes
+- (void)updateDatePicker:(NSDictionary *)attributes
 {
     NSString *type = [WXConvert NSString:attributes[@"type"]];
     if(type)
     {
         _type = type;
-    }
-    if(_type)
-    {
         if( [_type isEqualToString:@"date"])
         {
             self.datePicker.datePickerMode = UIDatePickerModeDate;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXHandlerFactory.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXHandlerFactory.m b/ios/sdk/WeexSDK/Sources/Manager/WXHandlerFactory.m
index 652af2b..2703883 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXHandlerFactory.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXHandlerFactory.m
@@ -8,7 +8,6 @@
 
 #import "WXHandlerFactory.h"
 #import "WXThreadSafeMutableDictionary.h"
-#import "WXNetworkDefaultImpl.h"
 #import "WXNavigationDefaultImpl.h"
 #import "WXAssert.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.h b/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.h
index 82d68a8..1bcef92 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.h
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.h
@@ -17,11 +17,11 @@
 /**
  *  The methods map
  **/
-@property (nonatomic, strong) NSMutableDictionary   *methods;
+@property (nonatomic, strong) NSMutableDictionary *asyncMethods;
+@property (nonatomic, strong) NSMutableDictionary *syncMethods;
 
 + (instancetype)sharedInstance;
 - (instancetype)initWithName:(NSString *)name class:(NSString *)clazz;
 - (void)registerMethods;
-- (void)dispatchMethod:(WXBridgeMethod*)method;
-- (NSInvocation*)invocationWithTargetMethod:(id)target method:(WXBridgeMethod*)method;
+
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.m b/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.m
index 1935d62..e725fc1 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXInvocationConfig.m
@@ -11,7 +11,6 @@
 #import "WXSDKInstance.h"
 #import "WXSDKManager.h"
 #import "WXSDKInstance_private.h"
-#import "WXModuleManager.h"
 #import "WXMonitor.h"
 #import "WXSDKError.h"
 #import "WXComponentFactory.h"
@@ -40,7 +39,8 @@
 {
     
     if (self = [super init]) {
-        _methods = [NSMutableDictionary new];
+        _asyncMethods = [NSMutableDictionary new];
+        _syncMethods = [NSMutableDictionary new];
     }
     
     return self;
@@ -48,94 +48,13 @@
 
 - (instancetype)initWithName:(NSString *)name class:(NSString *)clazz
 {
-    if (self = [super init]) {
-        _methods = [NSMutableDictionary new];
+    if (self = [self init]) {
         _name = name;
         _clazz = clazz;
     }
     return self;
 }
 
-- (void)dispatchMethod:(WXBridgeMethod *)method
-{
-    if(method.targets) {
-        WXSDKInstance *weexInstance = [WXSDKManager instanceForID:method.instance];
-        [[weexInstance componentManager] dispatchComponentMethod:method];
-    }
-    if (method.module) {
-        [[WXSDKManager moduleMgr] dispatchMethod:method];
-    }
-}
-
-- (NSInvocation*)invocationWithTargetMethod:(id)target method:(WXBridgeMethod*)method
-{
-    if (!target) {
-        NSString *errorMessage = [NSString stringWithFormat:@"%@ doesn't exist\uff01",method.targets[@"component"]?:method.module];
-        WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
-        
-        return nil;
-    }
-    SEL selector = nil;
-    if ([target conformsToProtocol:NSProtocolFromString(@"WXModuleProtocol")]) {
-        selector = [WXModuleFactory methodWithModuleName:method.module withMethod:method.method];
-    }else if ([target isKindOfClass:NSClassFromString(@"WXComponent")]) {
-        selector = [WXComponentFactory methodWithComponentName:method.targets[@"component"] withMethod:method.method];
-    }
-    
-    // neither a component nor a module
-    if (!selector) {
-        NSString *errorMessage = [NSString stringWithFormat:@"%@ is not a component or module", method.targets[@"component"]?:method.module];
-        WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
-        return nil;
-    }
-    
-    NSArray *arguments = method.arguments;
-    NSMethodSignature *signature = [target methodSignatureForSelector:selector];
-    if (!signature) {
-        NSString *errorMessage = [NSString stringWithFormat:@"%@, method\uff1a%@ doesn't exist", method.targets[@"component"]?:method.module, method.method];
-        WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
-        return nil;
-    }
-    
-    if (signature.numberOfArguments - 2 != method.arguments.count) {
-        NSString *errorMessage = [NSString stringWithFormat:@"%@, the parameters in calling method [%@] and registered method [%@] are not consistent\uff01", method.targets[@"component"]?:method.module, method.method, NSStringFromSelector(selector)];
-        WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
-        return nil;
-    }
-    
-    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
-    invocation.target = target;
-    invocation.selector = selector;
-    NSString *instanceId = method.instance;
-    void **freeList = NULL;
-    
-    NSMutableArray *blockArray = [NSMutableArray array];
-    WX_ALLOC_FLIST(freeList, arguments.count);
-    for (int i = 0; i < arguments.count; i ++ ) {
-        id obj = arguments[i];
-        const char *parameterType = [signature getArgumentTypeAtIndex:i + 2];
-        static const char *blockType = @encode(typeof(^{}));
-        id argument;
-        if (!strcmp(parameterType, blockType)) {
-            // callback
-            argument = [^void(NSString *result, BOOL keepAlive) {
-                [[WXSDKManager bridgeMgr]callBack:instanceId funcId:(NSString *)obj params:result keepAlive:keepAlive];
-            } copy];
-            
-            // retain block
-            [blockArray addObject:argument];
-            [invocation setArgument:&argument atIndex:i + 2];
-        } else {
-            argument = obj;
-            WX_ARGUMENTS_SET(invocation, signature, i, argument, freeList);
-        }
-    }
-    [invocation retainArguments];
-    WX_FREE_FLIST(freeList, arguments.count);
-    
-    return invocation;
-}
-
 - (void)registerMethods
 {
     Class currentClass = NSClassFromString(_clazz);
@@ -150,8 +69,14 @@
         Method *methodList = class_copyMethodList(object_getClass(currentClass), &methodCount);
         for (unsigned int i = 0; i < methodCount; i++) {
             NSString *selStr = [NSString stringWithCString:sel_getName(method_getName(methodList[i])) encoding:NSUTF8StringEncoding];
-            
-            if (![selStr hasPrefix:@"wx_export_method_"]) continue;
+            BOOL isSyncMethod = NO;
+            if ([selStr hasPrefix:@"wx_export_method_sync_"]) {
+                isSyncMethod = YES;
+            } else if ([selStr hasPrefix:@"wx_export_method_"]) {
+                isSyncMethod = NO;
+            } else {
+                continue;
+            }
             
             NSString *name = nil, *method = nil;
             SEL selector = NSSelectorFromString(selStr);
@@ -171,7 +96,8 @@
                 name = method;
             }
             
-            [_methods setObject:method forKey:name];
+            NSMutableDictionary *methods = isSyncMethod ? _syncMethods : _asyncMethods;
+            [methods setObject:method forKey:name];
         }
         
         free(methodList);

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.h b/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.h
index 94d0404..e96c89b 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.h
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.h
@@ -26,12 +26,12 @@
  * @param method The module method
  *
  **/
-+ (SEL)methodWithModuleName:(NSString *)name withMethod:(NSString *)method;
++ (SEL)selectorWithModuleName:(NSString *)name methodName:(NSString *)method isSync:(BOOL *)isSync;
 
 /**
  * @abstract Registers a module for a given name and the implemented class
  *
- * @param module The module name to register
+ * @param name The module name to register
  *
  * @param clazz The module class to register
  *

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.m b/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.m
index 3ab7f50..cafef5e 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXModuleFactory.m
@@ -83,24 +83,27 @@ static WXModuleFactory *_sharedInstance = nil;
     return NSClassFromString(config.clazz);
 }
 
-- (SEL)_methodWithModuleName:(NSString *)name withMethod:(NSString *)method
+- (SEL)_selectorWithModuleName:(NSString *)name methodName:(NSString *)method isSync:(BOOL *)isSync
 {
     WXAssert(name && method, @"Fail to find selector with module name and method, please check if the parameters are correct \uff01");
     
-    NSString *selStr = nil; SEL selector = nil;
+    NSString *selectorString = nil;;
     WXModuleConfig *config = nil;
     
     [_moduleLock lock];
     config = [_moduleMap objectForKey:name];
-    if (config.methods) {
-        selStr = [config.methods objectForKey:method];
+    if (config.syncMethods) {
+        selectorString = [config.syncMethods objectForKey:method];
+        if (selectorString && isSync) {
+            *isSync = YES;
+        }
     }
-    if (selStr) {
-        selector = NSSelectorFromString(selStr);
+    if (!selectorString && config.asyncMethods) {
+        selectorString = [config.asyncMethods objectForKey:method];;
     }
     [_moduleLock unlock];
     
-    return selector;
+    return NSSelectorFromString(selectorString);
 }
 
 - (NSString *)_registerModule:(NSString *)name withClass:(Class)clazz
@@ -122,7 +125,7 @@ static WXModuleFactory *_sharedInstance = nil;
 - (NSMutableDictionary *)_moduleMethodMapsWithName:(NSString *)name
 {
     NSMutableDictionary *dict = [NSMutableDictionary dictionary];
-    NSMutableArray *methods = [NSMutableArray array];
+    NSMutableArray *methods = [self _defaultModuleMethod];
     
     [_moduleLock lock];
     [dict setValue:methods forKey:name];
@@ -131,12 +134,19 @@ static WXModuleFactory *_sharedInstance = nil;
     void (^mBlock)(id, id, BOOL *) = ^(id mKey, id mObj, BOOL * mStop) {
         [methods addObject:mKey];
     };
-    [config.methods enumerateKeysAndObjectsUsingBlock:mBlock];
+    [config.syncMethods enumerateKeysAndObjectsUsingBlock:mBlock];
+    [config.asyncMethods enumerateKeysAndObjectsUsingBlock:mBlock];
     [_moduleLock unlock];
     
     return dict;
 }
 
+// module common method
+- (NSMutableArray*)_defaultModuleMethod
+{
+    return [NSMutableArray arrayWithObjects:@"addEventListener",@"removeAllEventListeners", nil];
+}
+
 - (NSDictionary *)_getModuleConfigs {
     NSMutableDictionary *moduleDic = [[NSMutableDictionary alloc] init];
     void (^moduleBlock)(id, id, BOOL *) = ^(id mKey, id mObj, BOOL * mStop) {
@@ -160,9 +170,9 @@ static WXModuleFactory *_sharedInstance = nil;
     return [[self _sharedInstance] _classWithModuleName:name];
 }
 
-+ (SEL)methodWithModuleName:(NSString *)name withMethod:(NSString *)method
++ (SEL)selectorWithModuleName:(NSString *)name methodName:(NSString *)method isSync:(BOOL *)isSync
 {
-    return [[self _sharedInstance] _methodWithModuleName:name withMethod:method];
+    return [[self _sharedInstance] _selectorWithModuleName:name methodName:method isSync:isSync];
 }
 
 + (NSString *)registerModule:(NSString *)name withClass:(Class)clazz

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXModuleManager.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXModuleManager.h b/ios/sdk/WeexSDK/Sources/Manager/WXModuleManager.h
deleted file mode 100644
index 4e66665..0000000
--- a/ios/sdk/WeexSDK/Sources/Manager/WXModuleManager.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Created by Weex.
- * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
- *
- * This source code is licensed under the Apache Licence 2.0.
- * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
- */
-
-#import <Foundation/Foundation.h>
-#import "WXBridgeMethod.h"
-
-@interface WXModuleManager : NSObject
-
-- (void)dispatchMethod:(WXBridgeMethod *)method;
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXModuleManager.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXModuleManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXModuleManager.m
deleted file mode 100644
index 579f441..0000000
--- a/ios/sdk/WeexSDK/Sources/Manager/WXModuleManager.m
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Created by Weex.
- * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
- *
- * This source code is licensed under the Apache Licence 2.0.
- * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
- */
-
-#import "WXModuleManager.h"
-#import "WXModuleProtocol.h"
-#import "WXUtility.h"
-#import "WXAssert.h"
-#import "WXModuleFactory.h"
-#import "WXSDKError.h"
-#import "WXMonitor.h"
-#import "WXSDKManager.h"
-#import "WXThreadSafeMutableDictionary.h"
-#import "WXInvocationConfig.h"
-
-#import <objc/message.h>
-
-@interface WXModuleManager ()
-
-@property (nonatomic, strong) WXThreadSafeMutableDictionary *indexDict;
-
-@end
-
-@implementation WXModuleManager
-
-- (instancetype)init
-{
-    self = [super init];
-    if(self){
-        _indexDict = [[WXThreadSafeMutableDictionary alloc]init];
-    }
-    return self;
-}
-
-#pragma mark Private Methods
-
-- (void)_executeModuleThead:(NSThread *)thread withBlock:(dispatch_block_t)block
-{
-    if (!thread || !block) return;
-    
-    if ([NSThread currentThread] == thread) {
-        block();
-    } else {
-        [self performSelector:@selector(_executeModuleBlock:)
-                     onThread:thread
-                   withObject:[block copy]
-                waitUntilDone:NO];
-    }
-}
-
-- (void)_executeModuleBlock:(dispatch_block_t)block
-{
-    if (block) block();
-}
-
-- (void)_executeModuleMethod:(id)module withMethod:(WXBridgeMethod *)method
-{
-    NSInvocation *invocation = [[WXInvocationConfig sharedInstance] invocationWithTargetMethod:module method:method];
-    [invocation invoke];
-}
-
-#pragma mark Public Methods
-
-- (void)dispatchMethod:(WXBridgeMethod *)method
-{
-    if (!method) return;
-    
-    Class module =  [WXModuleFactory classWithModuleName:method.module];
-    if (!module) {
-        NSString *errorMessage = [NSString stringWithFormat:@"Module\uff1a%@ doesn't exist\uff01", method.module];
-        WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
-        return;
-    }
-    
-//    WXLogDebug(@"execute\uff1a[module %@], [method %@], [parameter %@]", method.module, method.method, method.arguments);
-    
-    WXSDKInstance *weexInstance = [WXSDKManager instanceForID:method.instance];
-    id<WXModuleProtocol> moduleInstance = [weexInstance moduleForClass:module];
-    
-    // dispatch to user specified queue or thread, default is main thread
-    __weak typeof(self) weakSelf = self;
-    dispatch_block_t dipatchMethodBlock = ^ (){
-        [weakSelf _executeModuleMethod:moduleInstance withMethod:method];
-    };
-    
-    NSThread *targetThread = nil;
-    dispatch_queue_t targetQueue = nil;
-    if([moduleInstance respondsToSelector:@selector(targetExecuteQueue)]){
-        targetQueue = [moduleInstance targetExecuteQueue] ?: dispatch_get_main_queue();
-    } else if([moduleInstance respondsToSelector:@selector(targetExecuteThread)]){
-        targetThread = [moduleInstance targetExecuteThread] ?: [NSThread mainThread];
-    } else {
-        targetThread = [NSThread mainThread];
-    }
-    
-    WXAssert(targetQueue || targetThread, @"No queue or thread found for module:%@", moduleInstance);
-    
-    if (targetQueue) {
-        dispatch_async(targetQueue, dipatchMethodBlock);
-    } else {
-        WXPerformBlockOnThread(^{
-            dipatchMethodBlock();
-        }, targetThread);
-    }
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXRuleManager.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXRuleManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXRuleManager.m
index f45882d..e773485 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXRuleManager.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXRuleManager.m
@@ -63,7 +63,7 @@ static WXRuleManager *_sharedInstance = nil;
             
             NSString *fontSrc = [rule[@"src"] substringWithRange:NSMakeRange(start, end-start)];
             NSMutableString *newFontSrc = [fontSrc mutableCopy];
-            WX_REWRITE_URL(fontSrc, WXResourceTypeLink, self.instance, &newFontSrc)
+            WX_REWRITE_URL(fontSrc, WXResourceTypeFont, self.instance, &newFontSrc)
             
             if (!newFontSrc) {
                 return;
@@ -83,7 +83,12 @@ static WXRuleManager *_sharedInstance = nil;
                 // if the fontSrc string is illegal, the fontURL will be nil
                 return;
             }
-            [fontFamily setObject:fontSrc forKey:@"src"];
+            if([fontURL isFileURL]){
+                [fontFamily setObject:fontSrc forKey:@"src"];
+            }else {
+                [fontFamily setObject:fontSrc forKey:@"tempSrc"];
+            }
+            
             [_fontStorage setObject:fontFamily forKey:rule[@"fontFamily"]];
             // remote font file
             NSString *fontfile = [NSString stringWithFormat:@"%@/%@",WX_FONT_DOWNLOAD_DIR,[WXUtility md5:[fontURL absoluteString]]];
@@ -97,6 +102,8 @@ static WXRuleManager *_sharedInstance = nil;
                 if (!error && url) {
                     // load success
                     NSMutableDictionary * dictForFontFamily = [weakSelf.fontStorage objectForKey:rule[@"fontFamily"]];
+                    NSString *fontSrc = [dictForFontFamily objectForKey:@"tempSrc"];
+                    [dictForFontFamily setObject:fontSrc forKey:@"src"];
                     [dictForFontFamily setObject:url forKey:@"localSrc"];
                 } else {
                     //there was some errors during loading

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h b/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h
index f1968ee..0f90420 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h
@@ -20,11 +20,6 @@
 + (WXBridgeManager *)bridgeMgr;
 
 /**
- * @abstract Returns module manager
- **/
-+ (WXModuleManager *)moduleMgr;
-
-/**
  * @abstract Returns weex instance for specific identifier
  **/
 + (WXSDKInstance *)instanceForID:(NSString *)identifier;
@@ -44,4 +39,9 @@
  **/
 + (void)unload;
 
+/**
+ * @abstract Returns module manager
+ **/
++ (WXModuleManager *)moduleMgr DEPRECATED_MSG_ATTRIBUTE();
+
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.m
index c3347af..071bc2b 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.m
@@ -8,14 +8,11 @@
 
 #import "WXSDKManager.h"
 #import "WXThreadSafeMutableDictionary.h"
-#import "WXModuleManager.h"
 
 @interface WXSDKManager ()
 
 @property (nonatomic, strong) WXBridgeManager *bridgeMgr;
 
-@property (nonatomic, strong) WXModuleManager *moduleMgr;
-
 @property (nonatomic, strong) WXThreadSafeMutableDictionary *instanceDict;
 
 @end
@@ -46,16 +43,6 @@ static WXSDKManager *_sharedInstance = nil;
     return bridgeMgr;
 }
 
-+ (WXModuleManager *)moduleMgr
-{
-    WXModuleManager *moduleMgr = [self sharedInstance].moduleMgr;
-    if (!moduleMgr) {
-        moduleMgr = [[WXModuleManager alloc] init];
-        [self sharedInstance].moduleMgr = moduleMgr;
-    }
-    return moduleMgr;
-}
-
 + (id)instanceForID:(NSString *)identifier
 {
     return [[self sharedInstance].instanceDict objectForKey:identifier];
@@ -81,7 +68,11 @@ static WXSDKManager *_sharedInstance = nil;
     }
     
     [self sharedInstance].bridgeMgr = nil;
-    [self sharedInstance].moduleMgr = nil;
+}
+
++ (WXModuleManager *)moduleMgr
+{
+    return nil;
 }
 
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXServiceFactory.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXServiceFactory.h b/ios/sdk/WeexSDK/Sources/Manager/WXServiceFactory.h
new file mode 100644
index 0000000..3ff2174
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXServiceFactory.h
@@ -0,0 +1,38 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+
+@interface WXServiceFactory : NSObject
+
+/**
+ * @abstract Registers a service for a given name, js code and options
+ *
+ * @param name The service name to register
+ *
+ * @param options The service options to register
+ *
+ * @param code service js code to invoke
+ *
+ * @return script
+ *
+ */
++ (NSString *)registerServiceScript:(NSString *)name withRawScript:(NSString *)serviceScript withOptions:(NSDictionary *)options;
+
+
+/**
+ * @abstract Unregisters a component for a given name
+ *
+ * @param name The service name to register
+ *
+ * @return script
+ *
+ */
++ (NSString *)unregisterServiceScript:(NSString *)name;
+
+@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Manager/WXServiceFactory.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXServiceFactory.m b/ios/sdk/WeexSDK/Sources/Manager/WXServiceFactory.m
new file mode 100644
index 0000000..8953db0
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXServiceFactory.m
@@ -0,0 +1,102 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXServiceFactory.h"
+#import "WXAssert.h"
+#import "WXLog.h"
+
+#import <objc/runtime.h>
+
+@implementation WXServiceFactory
+{
+
+}
+
+#pragma mark Life Cycle
+
++ (instancetype)sharedInstance {
+    static id _sharedInstance = nil;
+    static dispatch_once_t oncePredicate;
+    dispatch_once(&oncePredicate, ^{
+        _sharedInstance = [[self alloc] init];
+    });
+    return _sharedInstance;
+}
+
+- (instancetype)init
+{
+    if(self = [super init]){
+
+    }
+    return self;
+}
+
+#pragma mark Public
+/**
+ * @abstract Unregisters a component for a given name
+ *
+ * @param name The service name to register
+ *
+ * @return script
+ *
+ */
++ (NSString *)registerServiceScript:(NSString *)name withRawScript:(NSString *)serviceScript withOptions:(NSDictionary *)options
+{
+    NSDictionary *dic = [[self sharedInstance] registerServiceScript:name withRawScript:serviceScript withOptions:options];
+    return [dic objectForKey:@"script"];
+}
+
+
++ (NSString *)unregisterServiceScript:(NSString *)name
+{
+    return [[self sharedInstance] unregisterServiceScript:name];
+}
+
+
+#pragma mark Private
+
+- (NSDictionary *)registerServiceScript:(NSString *)name withRawScript:(NSString *)serviceScript withOptions:(NSDictionary *)options
+{
+    WXAssert(name && options && serviceScript, @"name or options or code must not be nil for registering service.");
+    
+    NSDictionary *serverConfig = @{
+                                   @"name": name,
+                                   @"options": options,
+                                   @"script": [self registerService:name withRawScript:serviceScript withOptions:options]
+                                   };
+    
+    return serverConfig;
+}
+
+- (NSString *) registerService:(NSString *)name withRawScript:(NSString *)serviceScript withOptions:(NSDictionary *)options {
+    NSError *error;
+    
+    // setup options for service
+    NSMutableDictionary *optionDic = [NSMutableDictionary dictionaryWithDictionary:options];
+    [optionDic setObject:name forKey:@"serviceName"];
+    NSData *optionsData = [NSJSONSerialization dataWithJSONObject:optionDic options:NSJSONWritingPrettyPrinted error:&error];
+    NSString *optionsString = [[NSString alloc] initWithData:optionsData encoding:NSUTF8StringEncoding];
+    
+    // setup global function to service
+    NSString *funcString = @"{"
+                            @"register: global.registerService,"
+                            @"unregister: global.unregisterService"
+                            @"}";
+    
+    NSString *script = [NSString stringWithFormat:@";(function(service, options){ %@ })(%@, %@);"
+                        , serviceScript, funcString, optionsString];
+    return script;
+}
+
+- (NSString *) unregisterServiceScript: (NSString *) name
+{
+    NSString *script = [NSString stringWithFormat:@";global.unregisterService(%@);", name];
+    return script;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.h b/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.h
index f8dc62e..5cfc657 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.h
@@ -7,19 +7,19 @@
  */
 
 #import <Foundation/Foundation.h>
+@class WXSDKInstance;
 
 @interface WXBridgeMethod : NSObject
 
-@property (nonatomic, strong) NSString  *instance;
-@property (nonatomic, strong) NSString  *module;
-@property (nonatomic, strong) NSString  *method;
-@property (nonatomic, strong) NSArray   *arguments;
-@property (nonatomic, strong) NSDictionary *targets;
+@property (nonatomic, strong, readonly) NSString *methodName;
+@property (nonatomic, copy, readonly) NSArray *arguments;
+@property (nonatomic, weak, readonly) WXSDKInstance *instance;
 
-- (instancetype)initWihData:(NSDictionary *)data;
+- (instancetype)initWithMethodName:(NSString *)methodName
+                         arguments:(NSArray *)arguments
+                          instance:(WXSDKInstance *)instance;
 
-- (instancetype)initWithInstance:(NSString *)instance data:(NSMutableDictionary *)data;
-
-- (NSDictionary *)dataDesc;
+- (NSInvocation *)invocationWithTarget:(id)target selector:(SEL)selector;
 
 @end
+

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.m b/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.m
index d01a066..55becd0 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXBridgeMethod.m
@@ -7,40 +7,81 @@
  */
 
 #import "WXBridgeMethod.h"
+#import "WXSDKInstance.h"
+#import "WXMonitor.h"
+#import "WXAssert.h"
+#import "WXUtility.h"
+#import "WXSDKManager.h"
+#import <objc/runtime.h>
 
 @implementation WXBridgeMethod
 
-- (instancetype)initWihData:(NSDictionary *)data
+- (instancetype)initWithMethodName:(NSString *)methodName arguments:(NSArray *)arguments instance:(WXSDKInstance *)instance
 {
-    self = [super init];
-    if(self){
-        _module = [data valueForKey:@"module"];
-        _method = [data valueForKey:@"method"];
-        _arguments = [data valueForKey:@"args"];
-        if (data[@"component"]) {
-            self.targets = [NSMutableDictionary new];
-            [self.targets setValue:data[@"component"] forKey:@"component"];
-            [self.targets setValue:data[@"ref"]?:@"" forKey:@"ref"];
-        }
+    if (self = [super init]) {
+        _methodName = methodName;
+        _arguments = arguments;
+        _instance = instance;
     }
+    
     return self;
 }
 
-- (instancetype)initWithInstance:(NSString *)instance data:(NSMutableDictionary *)data
+- (NSString *)description
 {
-    self = [self initWihData:data];
-    if (self) {
-        _instance = instance;
-    }
-    return self;
+    return [NSString stringWithFormat:@"<%@: %p; instance = %@; method = %@; arguments= %@>", NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments];
 }
 
-- (NSDictionary *)dataDesc
+- (NSInvocation *)invocationWithTarget:(id)target selector:(SEL)selector
 {
-    NSString *module = _module ? : @"";
-    NSString *method = _method ? : @"";
-    NSArray *arguments = _arguments ? : @[];
-    return @{@"module":module, @"method":method, @"args":arguments};
+    WXAssert(target, @"No target for method:%@", self);
+    WXAssert(selector, @"No selector for method:%@", self);
+    
+    NSMethodSignature *signature = [target methodSignatureForSelector:selector];
+    if (!signature) {
+        NSString *errorMessage = [NSString stringWithFormat:@"target:%@, selector:%@ doesn't have a method signature", target, NSStringFromSelector(selector)];
+        WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
+        return nil;
+    }
+    
+    NSArray *arguments = _arguments;
+    if (signature.numberOfArguments - 2 < arguments.count) {
+        NSString *errorMessage = [NSString stringWithFormat:@"%@, the parameters in calling method [%@] and registered method [%@] are not consistent\uff01", target, _methodName, NSStringFromSelector(selector)];
+        WX_MONITOR_FAIL(WXMTJSBridge, WX_ERR_INVOKE_NATIVE, errorMessage);
+        return nil;
+    }
+    
+    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
+    invocation.target = target;
+    invocation.selector = selector;
+    NSString *instanceId = _instance.instanceId;
+    void **freeList = NULL;
+    
+    NSMutableArray *blockArray = [NSMutableArray array];
+    WX_ALLOC_FLIST(freeList, arguments.count);
+    for (int i = 0; i < arguments.count; i ++ ) {
+        id obj = arguments[i];
+        const char *parameterType = [signature getArgumentTypeAtIndex:i + 2];
+        static const char *blockType = @encode(typeof(^{}));
+        id argument;
+        if (!strcmp(parameterType, blockType)) {
+            // callback
+            argument = [^void(NSString *result, BOOL keepAlive) {
+                [[WXSDKManager bridgeMgr] callBack:instanceId funcId:(NSString *)obj params:result keepAlive:keepAlive];
+            } copy];
+            
+            // retain block
+            [blockArray addObject:argument];
+            [invocation setArgument:&argument atIndex:i + 2];
+        } else {
+            argument = obj;
+            WX_ARGUMENTS_SET(invocation, signature, i, argument, freeList);
+        }
+    }
+    [invocation retainArguments];
+    WX_FREE_FLIST(freeList, arguments.count);
+    
+    return invocation;
 }
 
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.h b/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
index 0b420b4..e8d7c0e 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
@@ -66,6 +66,11 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, readonly, strong) NSDictionary *styles;
 
 /**
+ *  @abstract The component's pseudoClassStyles.
+ */
+@property (nonatomic, readonly, strong) NSDictionary *pseudoClassStyles;
+
+/**
  *  @abstract The component's attributes.
  */
 @property (nonatomic, readonly, strong) NSDictionary *attributes;
@@ -336,6 +341,11 @@ typedef void(^WXDisplayCompeletionBlock)(CALayer *layer, BOOL finished);
 - (WXDisplayBlock)displayBlock;
 
 /**
+ * readyToRender
+ */
+- (void)readyToRender;
+
+/**
  * @abstract Return a block to be called while drawing is finished.
  *
  * @discussion The block returned will be called on main thread.

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
index 8c04d8c..f35da20 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
@@ -8,6 +8,7 @@
 
 #import "WXComponent.h"
 #import "WXComponent_internal.h"
+#import "WXComponent+GradientColor.h"
 #import "WXComponentManager.h"
 #import "WXSDKManager.h"
 #import "WXSDKInstance.h"
@@ -24,6 +25,7 @@
 #import "WXTransform.h"
 #import "WXRoundedRect.h"
 #import <pthread/pthread.h>
+#import "WXComponent+PseudoClassManagement.h"
 
 #pragma clang diagnostic ignored "-Wincomplete-implementation"
 #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
@@ -66,12 +68,13 @@
         _ref = ref;
         _type = type;
         _weexInstance = weexInstance;
-        _styles = styles ? [NSMutableDictionary dictionaryWithDictionary:styles] : [NSMutableDictionary dictionary];
+        _styles = [self parseStyles:styles];
         _attributes = attributes ? [NSMutableDictionary dictionaryWithDictionary:attributes] : [NSMutableDictionary dictionary];
         _events = events ? [NSMutableArray arrayWithArray:events] : [NSMutableArray array];
-        
         _subcomponents = [NSMutableArray array];
         
+        _absolutePosition = CGPointMake(NAN, NAN);
+        
         _isNeedJoinLayoutSystem = YES;
         _isLayoutDirty = YES;
         _isViewFrameSyncWithCalculated = YES;
@@ -122,6 +125,16 @@
     return styles;
 }
 
+- (NSDictionary *)pseudoClassStyles
+{
+    NSDictionary *pseudoClassStyles;
+    pthread_mutex_lock(&_propertyMutex);
+    pseudoClassStyles = _pseudoClassStyles;
+    pthread_mutex_unlock(&_propertyMutex);
+    
+    return pseudoClassStyles;
+}
+
 - (NSString *)type
 {
     return _type;
@@ -189,8 +202,12 @@
             _view.backgroundColor = _backgroundColor;
         }
         
+        if (_backgroundImage) {
+            [self setGradientLayer];
+        }
+        
         if (_transform) {
-            _layer.transform = [[WXTransform new] getTransform:_transform withView:_view withOrigin:_transformOrigin];
+            _layer.transform = [[[WXTransform alloc] initWithInstance:self.weexInstance] getTransform:_transform withView:_view withOrigin:_transformOrigin];
         }
         
         _view.wx_component = self;
@@ -198,6 +215,7 @@
         _layer.wx_component = self;
         
         [self _initEvents:self.events];
+        [self _initPseudoEvents:_isListenPseudoTouch];
         
         if (_positionType == WXPositionTypeSticky) {
             [self.ancestorScroller addStickyComponent:self];
@@ -355,11 +373,13 @@
 
 #pragma mark Updating
 
-- (void)_updateStylesOnComponentThread:(NSDictionary *)styles resetStyles:(NSMutableArray *)resetStyles
+- (void)_updateStylesOnComponentThread:(NSDictionary *)styles resetStyles:(NSMutableArray *)resetStyles isUpdateStyles:(BOOL)isUpdateStyles
 {
-    pthread_mutex_lock(&_propertyMutex);
-    [_styles addEntriesFromDictionary:styles];
-    pthread_mutex_unlock(&_propertyMutex);
+    if (isUpdateStyles) {
+        pthread_mutex_lock(&_propertyMutex);
+        [_styles addEntriesFromDictionary:styles];
+        pthread_mutex_unlock(&_propertyMutex);
+    }
     [self _updateCSSNodeStyles:styles];
     [self _resetCSSNodeStyles:resetStyles];
 }
@@ -388,7 +408,6 @@
 - (void)_updateStylesOnMainThread:(NSDictionary *)styles resetStyles:(NSMutableArray *)resetStyles
 {
     WXAssertMainThread();
-    
     [self _updateViewStyles:styles];
     [self _resetStyles:resetStyles];
     [self _handleBorders:styles isUpdating:YES];
@@ -411,6 +430,13 @@
     WXAssertMainThread();
 }
 
+- (void)readyToRender
+{
+    if (self.weexInstance.trackComponent) {
+        [self.supercomponent readyToRender];
+    }
+}
+
 - (void)updateAttributes:(NSDictionary *)attributes
 {
     WXAssertMainThread();

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/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 38fd09b..9faebdd 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h
@@ -8,6 +8,7 @@
 
 #import <UIKit/UIKit.h>
 #import "WXComponent.h"
+@class WXResourceRequest;
 
 extern NSString *const bundleUrlOptionKey;
 
@@ -140,6 +141,15 @@ typedef NS_ENUM(NSInteger, WXErrorCode) {//error.code
 @property (nonatomic, strong) NSMutableDictionary *userInfo;
 
 /**
+ *  scale factor from css unit to device pixel.
+ */
+@property (nonatomic, assign, readonly) CGFloat pixelScaleFactor;
+
+/**
+ * track component render
+ */
+@property (nonatomic, assign)BOOL trackComponent;
+/**
  * Renders weex view with bundle url.
  *
  * @param url The url of bundle rendered to a weex view.
@@ -151,22 +161,41 @@ typedef NS_ENUM(NSInteger, WXErrorCode) {//error.code
  *
  * @param url The url of bundle rendered to a weex view.
  *
- * @param options The params passed by user, sometimes you should pass the value of "bundleUrl".
+ * @param options The params passed by user
  *
- * @param data The data the bundle needs when rendered.
+ * @param data The data the bundle needs when rendered.  Defalut is nil.
  **/
 - (void)renderWithURL:(NSURL *)url options:(NSDictionary *)options data:(id)data;
 
+///**
+// * Renders weex view with resource request.
+// *
+// * @param request The resource request specifying the URL to render with.
+// *
+// * @param options The params passed by user.
+// *
+// * @param data The data the bundle needs when rendered.  Defalut is nil.
+// **/
+//- (void)renderWithRequest:(WXResourceRequest *)request options:(NSDictionary *)options data:(id)data;
+
 /**
  * Renders weex view with source string of bundle and some others.
  *
- * @param options The params passed by user, sometimes you should pass the value of "bundleUrl".
+ * @param options The params passed by user.
  *
- * @param data The data the bundle needs when rendered.
+ * @param data The data the bundle needs when rendered. Defalut is nil.
  **/
 - (void)renderView:(NSString *)source options:(NSDictionary *)options data:(id)data;
 
 /**
+ * Reload the js bundle from the current URL and rerender.
+ *
+ * @param forcedReload when this parameter is true, the js bundle will always be reloaded from the server. If it is false, the instance may reload the js bundle from its cache. Default is false.
+ *
+ **/
+- (void)reload:(BOOL)forcedReload;
+
+/**
  * Refreshes current instance with data.
  *
  * @param data The data the bundle needs when rendered.
@@ -193,6 +222,17 @@ typedef NS_ENUM(NSInteger, WXErrorCode) {//error.code
  */
 - (NSUInteger)numberOfComponents;
 
+
+/**
+ * check whether the module eventName is registered
+ */
+- (BOOL)checkModuleEventRegistered:(NSString*)event moduleClassName:(NSString*)moduleClassName;
+
+/**
+ * fire module event;
+ */
+- (void)fireModuleEvent:(Class)module eventName:(NSString *)eventName params:(NSDictionary*)params;
+
 /**
  * fire global event
  */
@@ -212,12 +252,18 @@ typedef NS_ENUM(NSInteger, WXErrorCode) {//error.code
 @property (nonatomic, strong) NSMutableDictionary *performanceDict;
 
 
+/** 
+ * Deprecated 
+ */
 @property (nonatomic, strong) NSDictionary *properties DEPRECATED_MSG_ATTRIBUTE();
 @property (nonatomic, assign) NSTimeInterval networkTime DEPRECATED_MSG_ATTRIBUTE();
 @property (nonatomic, copy) void (^updateFinish)(UIView *);
 
-- (void)finishPerformance DEPRECATED_MSG_ATTRIBUTE();
+@end
+
+@interface WXSDKInstance (Deprecated)
 
+- (void)finishPerformance DEPRECATED_MSG_ATTRIBUTE();
 - (void)reloadData:(id)data  DEPRECATED_MSG_ATTRIBUTE("Use refreshInstance: method instead.");
 - (void)creatFinish DEPRECATED_MSG_ATTRIBUTE();