{"size": 925, "ext": "js", "max_stars_repo_path": "demo/15_shear/render/demo2.js", "max_stars_repo_name": "jizai945/my_electron", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "demo/15_shear/render/demo2.js", "max_issues_repo_name": "jizai945/my_electron", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "demo/15_shear/render/demo2.js", "max_forks_repo_name": "jizai945/my_electron", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.125, "max_line_length": 63, "alphanum_fraction": 0.5697297297}
const btn = this.document.querySelector('#btn');
const BrowserWindow = require('electron').remote.BrowserWindow;

window.onload = function() {
    btn.onclick = ()=>{
        newWin = new BrowserWindow({
            width:500,
            heigth:500
        });
        newWin.loadFile('yellow.html');
        newWin.on('close', ()=>{
            newWin = null;
        })
    }
}

const {remote} = require('electron')
const ipc = require('electron').ipcRenderer
var rightTemplate = [
    {
        label:'复制，开发者',
        accelerator:'ctrl+c',
        click:()=>{
            console.log(123)
            ipc.send('debug-message', 'ping')   // 发消息
        }
    },
    {label:'粘贴', accelerator:'ctrl+v'}
]

var m = remote.Menu.buildFromTemplate(rightTemplate)


// 右击事件
window.addEventListener('contextmenu', function(e){
    e.preventDefault()  // 默认响应事件组织掉

    // 使用右键模板
    m.popup({window:remote.getCurrentWindow()})
})