2020-03-20 20:28:31 +00:00
|
|
|
import { Event } from '@electron/internal/renderer/extensions/event';
|
|
|
|
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
2016-06-16 16:46:26 +00:00
|
|
|
|
2016-06-16 19:07:59 +00:00
|
|
|
class WebNavigation {
|
2019-06-14 14:52:24 +00:00
|
|
|
private onBeforeNavigate = new Event()
|
|
|
|
private onCompleted = new Event()
|
2016-06-16 16:46:26 +00:00
|
|
|
|
2019-06-14 14:52:24 +00:00
|
|
|
constructor () {
|
2019-08-02 19:35:04 +00:00
|
|
|
ipcRendererInternal.on('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', (event: Electron.IpcRendererEvent, details: any) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
this.onBeforeNavigate.emit(details);
|
|
|
|
});
|
2016-06-16 19:07:59 +00:00
|
|
|
|
2019-08-02 19:35:04 +00:00
|
|
|
ipcRendererInternal.on('CHROME_WEBNAVIGATION_ONCOMPLETED', (event: Electron.IpcRendererEvent, details: any) => {
|
2020-03-20 20:28:31 +00:00
|
|
|
this.onCompleted.emit(details);
|
|
|
|
});
|
2016-06-16 19:07:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
export const setup = () => new WebNavigation();
|