refactor: replace ipcRendererUtils.invoke() with ipcRendererInternal.invoke() (#19574)
This commit is contained in:
parent
698120daf0
commit
81e9dab52f
29 changed files with 195 additions and 164 deletions
|
@ -1,4 +1,5 @@
|
|||
import { invoke, invokeSync } from '@electron/internal/renderer/ipc-renderer-internal-utils'
|
||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal'
|
||||
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils'
|
||||
|
||||
window.onload = function () {
|
||||
// Use menu API to show context menu.
|
||||
|
@ -19,7 +20,7 @@ function completeURL (project: string, path: string) {
|
|||
|
||||
// The DOM implementation expects (message?: string) => boolean
|
||||
(window.confirm as any) = function (message: string, title: string) {
|
||||
return invokeSync('ELECTRON_INSPECTOR_CONFIRM', message, title) as boolean
|
||||
return ipcRendererUtils.invokeSync('ELECTRON_INSPECTOR_CONFIRM', message, title) as boolean
|
||||
}
|
||||
|
||||
const useEditMenuItems = function (x: number, y: number, items: ContextMenuItem[]) {
|
||||
|
@ -32,7 +33,7 @@ const useEditMenuItems = function (x: number, y: number, items: ContextMenuItem[
|
|||
|
||||
const createMenu = function (x: number, y: number, items: ContextMenuItem[]) {
|
||||
const isEditMenu = useEditMenuItems(x, y, items)
|
||||
invoke<number>('ELECTRON_INSPECTOR_CONTEXT_MENU', items, isEditMenu).then(id => {
|
||||
ipcRendererInternal.invoke<number>('ELECTRON_INSPECTOR_CONTEXT_MENU', items, isEditMenu).then(id => {
|
||||
if (typeof id === 'number') {
|
||||
window.DevToolsAPI!.contextMenuItemSelected(id)
|
||||
}
|
||||
|
@ -41,7 +42,7 @@ const createMenu = function (x: number, y: number, items: ContextMenuItem[]) {
|
|||
}
|
||||
|
||||
const showFileChooserDialog = function (callback: (blob: File) => void) {
|
||||
invoke<[ string, any ]>('ELECTRON_INSPECTOR_SELECT_FILE').then(([path, data]) => {
|
||||
ipcRendererInternal.invoke<[ string, any ]>('ELECTRON_INSPECTOR_SELECT_FILE').then(([path, data]) => {
|
||||
if (path && data) {
|
||||
callback(dataToHtml5FileObject(path, data))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue