
EvEmbed::createStopped 메서드는 Electron의 WebContents에 대한 stopped 이벤트를 등록하는 데 사용됩니다.
stopped 이벤트는 Electron 앱이 종료되거나 WebContents가 종료될 때 발생하는 이벤트입니다.
이 메서드를 사용하여 stopped 이벤트를 등록하는 방법은 다음과 같습니다.
#hostingforum.kr
javascript
const { BrowserWindow } = require('electron');
let win;
function createWindow() {
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
});
win.on('closed', () => {
win = null;
});
win.webContents.on('stopped', () => {
console.log('stopped 이벤트 발생');
});
win.loadURL(`file://${__dirname}/index.html`);
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
});
EvEmbed::createStopped 메서드의 파라미터는 없습니다. 이 메서드는 WebContents에 대한 stopped 이벤트를 등록하는 데 사용되며, 이벤트가 발생할 때마다 콜백 함수를 호출합니다.
이 메서드를 사용하여 stopped 이벤트를 등록하면 Electron 앱이 종료되거나 WebContents가 종료될 때 콜백 함수가 호출되어 stopped 이벤트를 처리할 수 있습니다.
2025-03-28 04:21