mirror of
https://gitee.com/energye/energy.git
synced 2024-12-16 02:11:35 +08:00
85 lines
2.3 KiB
Go
85 lines
2.3 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,
|
|
"doubleField": 999991.102,
|
|
"boolean:Field": true,
|
|
}
|
|
let arrayValue = [
|
|
100, 200, "数组里的字符串", 66996.99, objectValue, true, false
|
|
]
|
|
try {
|
|
ipc.emit("emitName", ["stringValue", 100, true, 1999.66, "字符串?", 29999.66, objectValue, arrayValue, 8888888], 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> |