1.electron binary file을 download후
2.electron/resources
폴더에 app
폴더 생성
3.app 폴더 안에 package.json
파일 생성 및 아래 내용 추가
{ "name" : "DICOM-Viewer", "version" : "0.0", "main" : "main.js" }
4.main.js
파일 생성 및 아래 내용 추가. 아래 예제는 electron document 시작 하기 처음 내용
대충 electron을 사용하여 window생성 및 index.html
파일 load 수행
const {app, BrowserWindow} = require('electron') const path = require('path') const url = require('url') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let win function createWindow () { // Create the browser window. win = new BrowserWindow({width: 800, height: 600}) // and load the index.html of the app. win.loadURL(url.format({ pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true })) // Open the DevTools. win.webContents.openDevTools() // Emitted when the window is closed. win.on('closed', () => { // 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 }) } // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. app.on('ready', createWindow) // Quit when all windows are closed. app.on('window-all-closed', () => { // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } }) app.on('activate', () => { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (win === null) { createWindow() } }) // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here.
5.예제로 기존 svg.js interaction sample이 정상 구동되는지 확인하기 위해
기존 index.html을 그대로 사용
<html> <head> <title>test svg.js</title> </head> <body> <div id="drawing_svgjs_intersection"></div> <script type="text/javascript" src="bundle.js"></script> </body> </html>
6.bundle.js
파일을 copy. 모든 준비 완료
7.electron.exe
실행 시 정상적으로 구동되는거 확인