chore: convert extension apis to TypeScript (#18688)
Converts extensions-related files to TS
This commit is contained in:
parent
6e327184bd
commit
ffb53405fb
6 changed files with 66 additions and 85 deletions
20
lib/renderer/extensions/web-navigation.ts
Normal file
20
lib/renderer/extensions/web-navigation.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { Event } from '@electron/internal/renderer/extensions/event'
|
||||
import { IpcMainEvent } from 'electron'
|
||||
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal')
|
||||
|
||||
class WebNavigation {
|
||||
private onBeforeNavigate = new Event()
|
||||
private onCompleted = new Event()
|
||||
|
||||
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()
|
Loading…
Add table
Add a link
Reference in a new issue