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 () {
    // }
})
