electron/spec/fixtures/module/preload-pdf-loaded-in-nested-subframe.js
2018-09-14 14:57:01 +10:00

15 lines
484 B
JavaScript

const { ipcRenderer } = require('electron')
document.addEventListener('DOMContentLoaded', (event) => {
var outerFrame = document.getElementById('outer-frame')
if (outerFrame) {
outerFrame.onload = function () {
var pdframe = outerFrame.contentWindow.document.getElementById('pdf-frame')
if (pdframe) {
pdframe.contentWindow.addEventListener('pdf-loaded', (event) => {
ipcRenderer.send('pdf-loaded', event.detail)
})
}
}
}
})