24 lines
626 B
JavaScript
24 lines
626 B
JavaScript
const { ipcRenderer } = require('electron')
|
|
|
|
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)
|
|
}
|
|
})
|
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
// document.getElementById("fullscreen-button").onclick = function () {
|
|
// }
|
|
})
|