2017-04-15 1 views
0

이것은 전자 문서 (문서)의 창을 만드는 표준 방법입니다.브라우저 창에서 javascript를로드하는 방법은 무엇입니까?

let win; 
function createWindow(){ 
    // Create the browser window. 
    win = new BrowserWindow({width: 680, height: 420, frame: false, transparent: true, show: false}); 

    // and load the index.html of the app. 
    win.loadURL(url.format({ 
    pathname: path.join(__dirname, 'test.html'), 
    protocol: 'file:', 
    slashes: true 
    })); 

    win.once('ready-to-show', function() { 
    win.show(); 
    }); 


    // Open the DevTools. 
    // win.webContents.openDevTools() 

    // Emitted when the window is closed. 
    win.on('closed', function() { 
    // Dereference the window object, usually you would store windows 
    // in an array if your app supports multi windows, this is the time 
    // when you should delete the corresponding element. 
    win = null; 
    }) 

} 

는 잘 작동하지만 내가 어떻게 test.html를에 <script> 태그를 사용하지 않고 창 컨텍스트에서 등 jQuery를 같은 자바 스크립트 파일들을로드 할 수 있습니다?

스크립트 태그를 사용하고 싶지 않은 이유는 .js 파일과 .html 파일이 많고 HTML이 변경 될 때마다 업데이트하고 싶지 않기 때문입니다. 차라리 윈도우를 만드는 함수에 넣을 수 있습니다.

답변

관련 문제