energy/example/dev-test/ipc-event/resources/ipc-event.html
2023-03-03 11:43:19 +08:00

83 lines
2.2 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">
function ipcEmit() {
let objectValueArray = [
100, 200, "数组里的字符串", 66996.99,
]
let objectValue = {
"stringField": "stringFieldValue",
"intField": 1000,
"arrayField": objectValueArray,
}
let arrayValue = [
100, 200, "数组里的字符串", 66996.99, objectValue
]
try {
ipc.emit("emitName", ["stringValue", 100, true, 1999.66, "字符串?", 29999.66, objectValue, arrayValue], function (result) {
});
} catch (e) {
msg(e);
}
}
function ipcOn() {
ipc.on('onName', 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="overflow: hidden;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>
<button onclick="ipcOn()">ipcOn</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>