2023-03-21 22:39:44 +08:00
|
|
|
const { ipcRenderer } = require('electron')
|
2022-11-28 18:36:52 +08:00
|
|
|
|
2023-03-21 22:39:44 +08:00
|
|
|
window.addEventListener('message', function (e) {
|
|
|
|
// 获取消息内容 data
|
|
|
|
const { data } = e;
|
|
|
|
console.log("[electron preload]", data)
|
|
|
|
try {
|
|
|
|
let message = JSON.parse(data);
|
|
|
|
console.log(message)
|
|
|
|
switch (message.action) {
|
|
|
|
case 'fullscreen':
|
|
|
|
ipcRenderer.send('toggle-fullscreen')
|
|
|
|
break
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
console.log("err", err)
|
|
|
|
}
|
|
|
|
})
|
2022-11-28 15:22:56 +08:00
|
|
|
|
2022-11-28 18:36:52 +08:00
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
|
|
// document.getElementById("fullscreen-button").onclick = function () {
|
|
|
|
// }
|
2022-11-28 15:22:56 +08:00
|
|
|
})
|