[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16405874#comment-16405874
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user TheKingOfGods closed the pull request at:

https://github.com/apache/incubator-weex/pull/1058


> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: Android, iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> ~0301 Modified version~
> ~0302 Modified version~
>  _0307 Modified version_
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [WXWebComponent.m|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  ** 
> [WXWebComponent.h|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.h]
>  ** 
> [WXWebViewModule.m|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Module/WXWebViewModule.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/3576ed477d21dc020e63bf57dc414fff]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/3576ed477d21dc020e63bf57dc414fff.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3. 
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |!https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif|width=240!|!https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png|width=600!|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:(W3c 
> [MessageEvent|https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent])
>  // Weex postMessage to web
>  * -(void)postMessage:(NSDictionary *)data
> Unknown macro: \{WXSDKInstance *instance = [WXSDKEngine topInstance]; 
> NSMutableString *bundleUrlOrigin = @""; if (instance.pageName) { NSString 
> *bundleUrl = [instance.scriptURL absoluteString]; NSURL *url = [NSURL 
> URLWithString:bundleUrl]; bundleUrlOrigin = [NSString 
> stringWithFormat:@"%@://%@%@", url.scheme, url.host, url.port ? [NSString 
> stringWithFormat:@":%@", url.port] : @""]; } NSDictionary *initDic = @\{ 
> @"type" : @"message", @"data" : data, @"origin" : bundleUrlOrigin }; NSString 
> *json = [WXUtility JSONString}
> ())", json];
>  [_jsContext evaluateScript:code];
>  }
>  * How to use:
>  // Weex
>  const webview = weex.requireModule('webview');
>  // recommend
>  this.$refs['wxc-web'].postMessage(\{ detail: "a message" });
>  //not recommend
>  //webview.postMessage(this.$refs.webview, \{detail:"a message"});
>   
>  // Web
>  window.addEventListener('message',function(e) \{ 
> console.log(e.data,e.type,e.origin); // \{ detail: "a message" }
> ,"message","*"
>  },false)
> h4. Support to send messages from a html in component to Weex.
>  * Native:(W3c 
> [MessageEvent|https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent])
>  
>   
>  //Weex catch postMessage event from web
>  _jsContext[@"postMessage"] = ^() {
>   
>  NSArray *args = [JSContext currentArguments];
>   
>  if (args && args.count < 2)
> { return; }
>   
>  NSDictionary *data = [args[0] toDictionary];
>  NSString *origin = [args[1] toString];
>   
>  if (data == nil) \{ return; }
>  
>  NSDictionary *initDic = @
> { @"type" : @"message", @"data" : data, @"origin" : origin }
> ;
>   
>  [weakSelf fireEvent:@"message" params:initDic];
>  };
>   
>  * How to use:
>  // Weex
>  
>   
>  onMessage (e) \{ console.log(e.data,e.type,e.origin); // \{ detail: "a 
> message" }
> ,"message","*"
>  },
>   
>  // Web iframe
>  window.parent.postMessage(\{ detail: "a message" }, '*');
> h4. Support to render html 

[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16405796#comment-16405796
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user misakuo commented on the issue:

https://github.com/apache/incubator-weex/pull/1058
  
This pull request has been merged, please close it manually 欄 
@TheKingOfGods 


> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: Android, iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> ~0301 Modified version~
> ~0302 Modified version~
>  _0307 Modified version_
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [WXWebComponent.m|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  ** 
> [WXWebComponent.h|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.h]
>  ** 
> [WXWebViewModule.m|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Module/WXWebViewModule.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/3576ed477d21dc020e63bf57dc414fff]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/3576ed477d21dc020e63bf57dc414fff.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3. 
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |!https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif|width=240!|!https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png|width=600!|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:(W3c 
> [MessageEvent|https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent])
>  // Weex postMessage to web
>  * -(void)postMessage:(NSDictionary *)data
> Unknown macro: \{WXSDKInstance *instance = [WXSDKEngine topInstance]; 
> NSMutableString *bundleUrlOrigin = @""; if (instance.pageName) { NSString 
> *bundleUrl = [instance.scriptURL absoluteString]; NSURL *url = [NSURL 
> URLWithString:bundleUrl]; bundleUrlOrigin = [NSString 
> stringWithFormat:@"%@://%@%@", url.scheme, url.host, url.port ? [NSString 
> stringWithFormat:@":%@", url.port] : @""]; } NSDictionary *initDic = @\{ 
> @"type" : @"message", @"data" : data, @"origin" : bundleUrlOrigin }; NSString 
> *json = [WXUtility JSONString}
> ())", json];
>  [_jsContext evaluateScript:code];
>  }
>  * How to use:
>  // Weex
>  const webview = weex.requireModule('webview');
>  // recommend
>  this.$refs['wxc-web'].postMessage(\{ detail: "a message" });
>  //not recommend
>  //webview.postMessage(this.$refs.webview, \{detail:"a message"});
>   
>  // Web
>  window.addEventListener('message',function(e) \{ 
> console.log(e.data,e.type,e.origin); // \{ detail: "a message" }
> ,"message","*"
>  },false)
> h4. Support to send messages from a html in component to Weex.
>  * Native:(W3c 
> [MessageEvent|https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent])
>  
>   
>  //Weex catch postMessage event from web
>  _jsContext[@"postMessage"] = ^() {
>   
>  NSArray *args = [JSContext currentArguments];
>   
>  if (args && args.count < 2)
> { return; }
>   
>  NSDictionary *data = [args[0] toDictionary];
>  NSString *origin = [args[1] toString];
>   
>  if (data == nil) \{ return; }
>  
>  NSDictionary *initDic = @
> { @"type" : @"message", @"data" : data, @"origin" : origin }
> ;
>   
>  [weakSelf fireEvent:@"message" params:initDic];
>  };
>   
>  * How to use:
>  // Weex
>  
>   
>  onMessage (e) \{ console.log(e.data,e.type,e.origin); // \{ detail: "a 
> message" }
> ,"message","*"
>  },
>   
>  // Web iframe
>  

[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16394754#comment-16394754
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user asfgit closed the pull request at:

https://github.com/apache/incubator-weex/pull/1047


> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: Android, iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> ~0301 Modified version~
> ~0302 Modified version~
>  _0307 Modified version_
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [WXWebComponent.m|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  ** 
> [WXWebComponent.h|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.h]
>  ** 
> [WXWebViewModule.m|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Module/WXWebViewModule.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/3576ed477d21dc020e63bf57dc414fff]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/3576ed477d21dc020e63bf57dc414fff.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3. 
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |!https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif|width=240!|!https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png|width=600!|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:(W3c 
> [MessageEvent|https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent])
>  // Weex postMessage to web
>  * -(void)postMessage:(NSDictionary *)data
> Unknown macro: \{WXSDKInstance *instance = [WXSDKEngine topInstance]; 
> NSMutableString *bundleUrlOrigin = @""; if (instance.pageName) { NSString 
> *bundleUrl = [instance.scriptURL absoluteString]; NSURL *url = [NSURL 
> URLWithString:bundleUrl]; bundleUrlOrigin = [NSString 
> stringWithFormat:@"%@://%@%@", url.scheme, url.host, url.port ? [NSString 
> stringWithFormat:@":%@", url.port] : @""]; } NSDictionary *initDic = @\{ 
> @"type" : @"message", @"data" : data, @"origin" : bundleUrlOrigin }; NSString 
> *json = [WXUtility JSONString}
> ())", json];
>  [_jsContext evaluateScript:code];
>  }
>  * How to use:
>  // Weex
>  const webview = weex.requireModule('webview');
>  // recommend
>  this.$refs['wxc-web'].postMessage(\{ detail: "a message" });
>  //not recommend
>  //webview.postMessage(this.$refs.webview, \{detail:"a message"});
>   
>  // Web
>  window.addEventListener('message',function(e) \{ 
> console.log(e.data,e.type,e.origin); // \{ detail: "a message" }
> ,"message","*"
>  },false)
> h4. Support to send messages from a html in component to Weex.
>  * Native:(W3c 
> [MessageEvent|https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent])
>  
>   
>  //Weex catch postMessage event from web
>  _jsContext[@"postMessage"] = ^() {
>   
>  NSArray *args = [JSContext currentArguments];
>   
>  if (args && args.count < 2)
> { return; }
>   
>  NSDictionary *data = [args[0] toDictionary];
>  NSString *origin = [args[1] toString];
>   
>  if (data == nil) \{ return; }
>  
>  NSDictionary *initDic = @
> { @"type" : @"message", @"data" : data, @"origin" : origin }
> ;
>   
>  [weakSelf fireEvent:@"message" params:initDic];
>  };
>   
>  * How to use:
>  // Weex
>  
>   
>  onMessage (e) \{ console.log(e.data,e.type,e.origin); // \{ detail: "a 
> message" }
> ,"message","*"
>  },
>   
>  // Web iframe
>  window.parent.postMessage(\{ detail: "a message" }, '*');
> h4. Support to render html source.
>  * 

[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-09 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16392574#comment-16392574
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user TheKingOfGods commented on a diff in the pull request:

https://github.com/apache/incubator-weex/pull/1058#discussion_r173389264
  
--- Diff: android/sdk/src/main/java/com/taobao/weex/ui/view/WXWebView.java 
---
@@ -230,7 +295,79 @@ public void onReceivedTitle(WebView view, String 
title) {
 }
 }
 
+@Override
--- End diff --

Yes, `addJavascriptInterface` is better, and it will be used when Android 
API >= 17 . But there is a 
[risk](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-6636) before 17. 
So `prompt`  is used as a downgrade when Android API < 17


> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: Android, iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> ~0301 Modified version~
> ~0302 Modified version~
>  _0307 Modified version_
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [WXWebComponent.m|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  ** 
> [WXWebComponent.h|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.h]
>  ** 
> [WXWebViewModule.m|https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Module/WXWebViewModule.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/3576ed477d21dc020e63bf57dc414fff]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/3576ed477d21dc020e63bf57dc414fff.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3. 
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |!https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif|width=240!|!https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png|width=600!|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:(W3c 
> [MessageEvent|https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent])
>  // Weex postMessage to web
>  * -(void)postMessage:(NSDictionary *)data
> Unknown macro: \{WXSDKInstance *instance = [WXSDKEngine topInstance]; 
> NSMutableString *bundleUrlOrigin = @""; if (instance.pageName) { NSString 
> *bundleUrl = [instance.scriptURL absoluteString]; NSURL *url = [NSURL 
> URLWithString:bundleUrl]; bundleUrlOrigin = [NSString 
> stringWithFormat:@"%@://%@%@", url.scheme, url.host, url.port ? [NSString 
> stringWithFormat:@":%@", url.port] : @""]; } NSDictionary *initDic = @\{ 
> @"type" : @"message", @"data" : data, @"origin" : bundleUrlOrigin }; NSString 
> *json = [WXUtility JSONString}
> ())", json];
>  [_jsContext evaluateScript:code];
>  }
>  * How to use:
>  // Weex
>  const webview = weex.requireModule('webview');
>  // recommend
>  this.$refs['wxc-web'].postMessage(\{ detail: "a message" });
>  //not recommend
>  //webview.postMessage(this.$refs.webview, \{detail:"a message"});
>   
>  // Web
>  window.addEventListener('message',function(e) \{ 
> console.log(e.data,e.type,e.origin); // \{ detail: "a message" }
> ,"message","*"
>  },false)
> h4. Support to send messages from a html in component to Weex.
>  * Native:(W3c 
> [MessageEvent|https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent])
>  
>   
>  //Weex catch postMessage event from web
>  _jsContext[@"postMessage"] = ^() {
>   
>  NSArray *args = [JSContext currentArguments];
>   
>  if (args && args.count < 2)
> { return; }
>   
>  

[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16389530#comment-16389530
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user tw93 commented on a diff in the pull request:

https://github.com/apache/incubator-weex/pull/1047#discussion_r172837062
  
--- Diff: ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m ---
@@ -104,6 +142,10 @@ - (void)updateAttributes:(NSDictionary *)attributes
 if (attributes[@"src"]) {
 self.url = attributes[@"src"];
 }
+
+if (attributes[@"source"]) {
--- End diff --

 done!


> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/8847473f8f596573dadb66a344edfce2]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/b1f6d242760945d4b674c4f5913a39e4.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3.  
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |[!https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966|width=240!|https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966]|[!https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67|width=600!|https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67]|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:
>  \{{- (void)postMessage:(NSDictionary *)data { NSDictionary *eventDict = @ { 
> @"data" : data }
> ; NSString *json = [WXUtility JSONString:eventDict]; NSString *code = 
> [NSString stringWithFormat:@"(function ()\\{document.dispatchEvent(new 
> MessageEvent('message', %@));}())",json]; [_jsContext evaluateScript:code]; } 
> }}
>  * How to use:
>  \{{// Weex const webview = weex.requireModule('webview'); 
> webview.postMessage(this.$refs.webview, {detail:"message"}); // Web 
> document.addEventListener('message',function(e)\{ console.log(e.data.detail) 
> },false) }}
> h4. Support to send messages from a html in component to Weex.
>  * Native:
>  {{_jsContext[@"postMessage"] = ^(JSValue *data){ [weakSelf 
> fireEvent:@"message" params:[data toDictionary]]; }; }}
>  * How to use:
>  \{{// Weex  // Web 
> window.postMessage(message, targetOrigin, false); }}
> h4. Support to render html source.
>  * Native:
>  {{[_webview loadHTMLString:_source baseURL:nil]; }}
>  * How to use:
>  
> Welcome to put forward any suggestion about the solution or other 
> requirements for the component, Thanks!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16389522#comment-16389522
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user acton393 commented on a diff in the pull request:

https://github.com/apache/incubator-weex/pull/1047#discussion_r172835622
  
--- Diff: ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m ---
@@ -104,6 +142,10 @@ - (void)updateAttributes:(NSDictionary *)attributes
 if (attributes[@"src"]) {
 self.url = attributes[@"src"];
 }
+
+if (attributes[@"source"]) {
--- End diff --

maybe we should update the initSource when update attributes,
as the view can be unloaded during the screen scroll, so the viewDidLoad 
method can called again with initSource


> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/8847473f8f596573dadb66a344edfce2]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/b1f6d242760945d4b674c4f5913a39e4.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3.  
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |[!https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966|width=240!|https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966]|[!https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67|width=600!|https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67]|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:
>  \{{- (void)postMessage:(NSDictionary *)data { NSDictionary *eventDict = @ { 
> @"data" : data }
> ; NSString *json = [WXUtility JSONString:eventDict]; NSString *code = 
> [NSString stringWithFormat:@"(function ()\\{document.dispatchEvent(new 
> MessageEvent('message', %@));}())",json]; [_jsContext evaluateScript:code]; } 
> }}
>  * How to use:
>  \{{// Weex const webview = weex.requireModule('webview'); 
> webview.postMessage(this.$refs.webview, {detail:"message"}); // Web 
> document.addEventListener('message',function(e)\{ console.log(e.data.detail) 
> },false) }}
> h4. Support to send messages from a html in component to Weex.
>  * Native:
>  {{_jsContext[@"postMessage"] = ^(JSValue *data){ [weakSelf 
> fireEvent:@"message" params:[data toDictionary]]; }; }}
>  * How to use:
>  \{{// Weex  // Web 
> window.postMessage(message, targetOrigin, false); }}
> h4. Support to render html source.
>  * Native:
>  {{[_webview loadHTMLString:_source baseURL:nil]; }}
>  * How to use:
>  
> Welcome to put forward any suggestion about the solution or other 
> requirements for the component, Thanks!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16389487#comment-16389487
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user acton393 commented on a diff in the pull request:

https://github.com/apache/incubator-weex/pull/1047#discussion_r172826404
  
--- Diff: ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m ---
@@ -69,6 +71,11 @@ - (instancetype)initWithRef:(NSString *)ref 
type:(NSString *)type styles:(NSDict
 {
 if (self = [super initWithRef:ref type:type styles:styles 
attributes:attributes events:events weexInstance:weexInstance]) {
 self.url = attributes[@"src"];
+
+if(attributes[@"source"]){
+self.source = attributes[@"source"];
--- End diff --

the init method is executed in background thread named component method and 
 `self.source` will call [self setSource:""], 
the method for `setSource` called view operation which is only for main 
thread.

A better way is that define another member for source to save the variable 
during  this initialization,  and call  self.source in component hook lifeCycle 
like  `viewDidLoad`.



> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/8847473f8f596573dadb66a344edfce2]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/b1f6d242760945d4b674c4f5913a39e4.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3.  
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |[!https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966|width=240!|https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966]|[!https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67|width=600!|https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67]|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:
>  \{{- (void)postMessage:(NSDictionary *)data { NSDictionary *eventDict = @ { 
> @"data" : data }
> ; NSString *json = [WXUtility JSONString:eventDict]; NSString *code = 
> [NSString stringWithFormat:@"(function ()\\{document.dispatchEvent(new 
> MessageEvent('message', %@));}())",json]; [_jsContext evaluateScript:code]; } 
> }}
>  * How to use:
>  \{{// Weex const webview = weex.requireModule('webview'); 
> webview.postMessage(this.$refs.webview, {detail:"message"}); // Web 
> document.addEventListener('message',function(e)\{ console.log(e.data.detail) 
> },false) }}
> h4. Support to send messages from a html in component to Weex.
>  * Native:
>  {{_jsContext[@"postMessage"] = ^(JSValue *data){ [weakSelf 
> fireEvent:@"message" params:[data toDictionary]]; }; }}
>  * How to use:
>  \{{// Weex  // Web 
> window.postMessage(message, 

[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16389479#comment-16389479
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user acton393 commented on a diff in the pull request:

https://github.com/apache/incubator-weex/pull/1047#discussion_r172825375
  
--- Diff: ios/sdk/WeexSDK/Sources/Module/WXWebViewModule.m ---
@@ -27,6 +27,7 @@ @implementation WXWebViewModule
 @synthesize weexInstance;
--- End diff --

webViewModule  method is  deprecated  gradually as we support component 
method, the same expose way as module method
see more details: 
http://weex.apache.org/guide/extend-ios.html#component-method

Maybe it will be better if use component method


> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/8847473f8f596573dadb66a344edfce2]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/b1f6d242760945d4b674c4f5913a39e4.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3.  
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |[!https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966|width=240!|https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966]|[!https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67|width=600!|https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67]|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:
>  \{{- (void)postMessage:(NSDictionary *)data { NSDictionary *eventDict = @ { 
> @"data" : data }
> ; NSString *json = [WXUtility JSONString:eventDict]; NSString *code = 
> [NSString stringWithFormat:@"(function ()\\{document.dispatchEvent(new 
> MessageEvent('message', %@));}())",json]; [_jsContext evaluateScript:code]; } 
> }}
>  * How to use:
>  \{{// Weex const webview = weex.requireModule('webview'); 
> webview.postMessage(this.$refs.webview, {detail:"message"}); // Web 
> document.addEventListener('message',function(e)\{ console.log(e.data.detail) 
> },false) }}
> h4. Support to send messages from a html in component to Weex.
>  * Native:
>  {{_jsContext[@"postMessage"] = ^(JSValue *data){ [weakSelf 
> fireEvent:@"message" params:[data toDictionary]]; }; }}
>  * How to use:
>  \{{// Weex  // Web 
> window.postMessage(message, targetOrigin, false); }}
> h4. Support to render html source.
>  * Native:
>  {{[_webview loadHTMLString:_source baseURL:nil]; }}
>  * How to use:
>  
> Welcome to put forward any suggestion about the solution or other 
> requirements for the component, Thanks!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (WEEX-233) More enhanced about component

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WEEX-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16389427#comment-16389427
 ] 

ASF GitHub Bot commented on WEEX-233:
-

Github user tw93 closed the pull request at:

https://github.com/apache/incubator-weex/pull/1047


> More enhanced about  component
> ---
>
> Key: WEEX-233
> URL: https://issues.apache.org/jira/browse/WEEX-233
> Project: Weex
>  Issue Type: Improvement
>  Components: iOS
>Reporter: TangWei
>Assignee: Adam Feng
>Priority: Major
>  Labels: features, newbie
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Hi, I'm Tw93(侑夕) from [Fliggy|https://www.fliggy.com/], I'd like to discuss 
> the enhancements about component, let it take over where we can't implement 
> through weex.
> h2. Target
> {{}} is used to display web content that specified by src attribute in 
> weex page,We also can use webview module to control WebView behavior such as 
> goBack, goForward and reload.
> But it's not enough in most businesses,I think a more enhanced web component 
> should have the following:
>  * Support to send messages from Weex to a html in component.
>  * Support to send messages from a html in component to Weex.
>  * Support to render html source.
> Previously, component was an island that only rendered a remote url, but 
> enabled it to communicate through the context native to the webView. Then I'm 
> going to describe the solution that I came up with.
> h2. My solution
> h3. Code
>  * Weex iOS:
>  ** 
> [https://github.com/tw93/incubator-weex/blob/ios-feature-enhanced-web/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m]
>  * Weex Vue Demo:
>  ** [http://dotwe.org/vue/8847473f8f596573dadb66a344edfce2]
>  ** [Demo Bundle 
> JS|http://dotwe.org/raw/dist/b1f6d242760945d4b674c4f5913a39e4.bundle.wx]
>  ** [Web End|http://h5.m.taobao.com/trip/wx-detection-demo/web.html]
> h3.  
> [Demo|https://gw.alipayobjects.com/zos/rmsportal/sBfTGamezxaBCGPshyXT.gif] && 
> [Theory|https://img.alicdn.com/tfs/TB1hEhXbxGYBuNjy0FnXXX5lpXa-1872-1208.png]
> |[!https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966|width=240!|https://camo.githubusercontent.com/4c7a7b69d686b8127a0bdc89962c1aceac912083/68747470733a2f2f67772e616c697061796f626a656374732e636f6d2f7a6f732f726d73706f7274616c2f7342665447616d657a78614243475073687958542e676966]|[!https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67|width=600!|https://camo.githubusercontent.com/b1ed3e13b070b8302c2cecb067346a8da051207c/68747470733a2f2f696d672e616c6963646e2e636f6d2f7466732f544231684568586278475942754e6a7930466e585858356c7058612d313837322d313230382e706e67]|
> h3. Details
> h4. Support to send messages from Weex to a html in component.
>  * Native:
>  \{{- (void)postMessage:(NSDictionary *)data { NSDictionary *eventDict = @ { 
> @"data" : data }
> ; NSString *json = [WXUtility JSONString:eventDict]; NSString *code = 
> [NSString stringWithFormat:@"(function ()\\{document.dispatchEvent(new 
> MessageEvent('message', %@));}())",json]; [_jsContext evaluateScript:code]; } 
> }}
>  * How to use:
>  \{{// Weex const webview = weex.requireModule('webview'); 
> webview.postMessage(this.$refs.webview, {detail:"message"}); // Web 
> document.addEventListener('message',function(e)\{ console.log(e.data.detail) 
> },false) }}
> h4. Support to send messages from a html in component to Weex.
>  * Native:
>  {{_jsContext[@"postMessage"] = ^(JSValue *data){ [weakSelf 
> fireEvent:@"message" params:[data toDictionary]]; }; }}
>  * How to use:
>  \{{// Weex  // Web 
> window.postMessage(message, targetOrigin, false); }}
> h4. Support to render html source.
>  * Native:
>  {{[_webview loadHTMLString:_source baseURL:nil]; }}
>  * How to use:
>  
> Welcome to put forward any suggestion about the solution or other 
> requirements for the component, Thanks!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)