energy/example/dev-test/ipc-event/resources/ipc-event.html
2023-03-06 12:26:25 +08:00

87 lines
2.5 KiB
Go

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ipc-event</title>
<style>
button {
margin: 5px;
}
</style>
<script type="application/javascript">
let idx = 0;
function ipcEmit() {
let objectValueArray = [
100, 200, "数组里的字符串", 66996.99,
]
let objectValue = {
"stringField": "stringFieldValue",
"intField": 1000,
"arrayField": objectValueArray,
"doubleField": 999991.102,
"booleanField": true,
}
let arrayValue = [
100, 200, "数组里的字符串", 66996.99, objectValue, true, false
]
let ok = ipc.emit("testEmitName", ["stringValue", 100+idx, true, 1999.66+idx, "字符串?", 29999.66+idx, objectValue, arrayValue, 8888888+idx, null, undefined], function (result1, result2, result3, result4, result5) {
msg('testEmitName 回调函数执行了', result1, result2, result3, result4, result5);
});
msg('ipc.emit ok?', ok);
let ok1 = ipc.emit([]);
msg('ipc.emit ok?', ok1);
idx++;
}
ipc.on('onTestName1', function (param1, param2, param3) {
});
ipc.on('onTestName2', function (param1, param2, param3) {
});
function bindFunc() {
energy.funcName();
}
function bindField() {
clearMsg();
msg('stringField', energy.stringField);
msg('intField', energy.intField);
msg('doubleField', energy.doubleField);
msg('boolField', energy.boolField);
}
</script>
</head>
<body style="margin: 0px;padding: 0px;">
<p>
<h3>process-message</h3></p>
<p><a target="_blank" href="ipc-event.html">open</a></p>
<p>
<button onclick="ipcEmit()">ipcEmit</button>
<br>
<button onclick="bindFunc()">bindFunc</button>
<button onclick="bindField()">bindField</button>
</p>
<p id="msgHtml"></p>
</body>
<script type="application/javascript">
let msgHtml = document.getElementById("msgHtml");
function msg(...vvv) {
let str = msgHtml.innerHTML;
for (let i = 0; i < vvv.length; i++) {
str = str + " " + vvv[i];
}
str += "<br>";
msgHtml.innerHTML = str;
}
function clearMsg() {
msgHtml.innerHTML = "";
}
msg("ipc-event: 页面加载完成...");
</script>
</html>