未验证 提交 27459426 编写于 作者: O openharmony_ci 提交者: Gitee

!20553 modify web-app-page-data-channel for sample code

Merge pull request !20553 from 李想/master
...@@ -90,7 +90,14 @@ ...@@ -90,7 +90,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebView Message Port Demo</title> <title>WebView Message Port Demo</title>
</head> </head>
<body>
<h1>WebView Message Port Demo</h1>
<div>
<input type="button" value="SendToEts" onclick="PostMsgToEts(msgFromJS.value);"/><br/>
<input id="msgFromJS" type="text" value="send this message from HTML to ets"/><br/>
</div>
<p class="output">display received message send from ets</p>
</body>
<script> <script>
var h5Port; var h5Port;
var output = document.querySelector('.output'); var output = document.querySelector('.output');
...@@ -107,7 +114,7 @@ ...@@ -107,7 +114,7 @@
msg = msg + result; msg = msg + result;
} else if (typeof(result) === 'object') { } else if (typeof(result) === 'object') {
if (result instanceof ArrayBuffer) { if (result instanceof ArrayBuffer) {
console.info(`received arraybuffer from html5, length is:` ${result.byteLength}`); console.info(`received arraybuffer from html5, length is: ${result.byteLength}`);
msg = msg + 'lenght is ' + result.byteLength; msg = msg + 'lenght is ' + result.byteLength;
} else { } else {
console.info('not support'); console.info('not support');
...@@ -130,14 +137,5 @@ ...@@ -130,14 +137,5 @@
} }
} }
</script> </script>
<body>
<h1>WebView Message Port Demo</h1>
<div>
<input type="button" value="SendToEts" onclick="PostMsgToEts(msgFromJS.value);"/><br/>
<input id="msgFromJS" type="text" value="send this message from HTML to ets"/><br/>
</div>
<p class="output">display received message send from ets</p>
</body>
</html> </html>
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册