1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
"use strict";function e(){var e;try{e=JSON.parse(r.readFileSync(d,"utf8"))}catch(t){}return"undefined"!=typeof e&&"undefined"!=typeof e.bounds?e.bounds:{width:1024,height:768}}function t(){var e={bounds:c.getBounds()};r.writeFileSync(d,JSON.stringify(e))}var o=require("app"),n=require("menu"),a=require("browser-window"),l=require("path"),r=require("fs"),d=l.join(o.getDataPath(),"debugger-config.json"),i=process.argv[2],u=[{label:"Electron",submenu:[{label:"Quit",accelerator:"Command+Q",click:function(){o.quit()}}]},{label:"View",submenu:[{label:"Reload",accelerator:"Command+R",click:function(){c&&c.reloadIgnoringCache()}}]},{label:"Edit",submenu:[{label:"Undo",accelerator:"Command+Z",selector:"undo:"},{label:"Redo",accelerator:"Command+Shift+Z",selector:"redo:"},{type:"separator"},{label:"Cut",accelerator:"Command+X",selector:"cut:"},{label:"Copy",accelerator:"Command+C",selector:"copy:"},{label:"Paste",accelerator:"Command+V",selector:"paste:"},{label:"Select All",accelerator:"Command+A",selector:"selectAll:"}]}],c=null;o.on("window-all-closed",function(){"darwin"!=process.platform&&o.quit()}),o.on("ready",function(){n.setApplicationMenu(n.buildFromTemplate(u));var o=e();c=new a(o),c.loadUrl(i),c.on("closed",function(){t(c),c=null});var l={x:c.getBounds().x,y:c.getBounds().y,width:c.getBounds().width,height:c.getBounds().height};setInterval(function(){(l.x!==c.getBounds().x||l.y!==c.getBounds().y||l.width!==c.getBounds().width||l.height!==c.getBounds().height)&&(t(),l={x:c.getBounds().x,y:c.getBounds().y,width:c.getBounds().width,height:c.getBounds().height})},500)}); |