electron/lib/renderer/extensions/web-navigation.ts

21 lines
683 B
TypeScript
Raw Normal View History

import { Event } from '@electron/internal/renderer/extensions/event'
import { IpcMainEvent } from 'electron'
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal')
2016-06-16 16:46:26 +00:00
class WebNavigation {
private onBeforeNavigate = new Event()
private onCompleted = new Event()
2016-06-16 16:46:26 +00:00
constructor () {
ipcRendererInternal.on('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', (event: IpcMainEvent, details: any) => {
this.onBeforeNavigate.emit(details)
})
ipcRendererInternal.on('CHROME_WEBNAVIGATION_ONCOMPLETED', (event: IpcMainEvent, details: any) => {
this.onCompleted.emit(details)
})
}
}
export const setup = () => new WebNavigation()