From 60b8eb91bd8502e6e0c126334a704ec328dfa5fc Mon Sep 17 00:00:00 2001 From: Aoichaan0513 Date: Mon, 15 Aug 2022 09:43:07 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20BrowserView=20=E3=81=AE=20Preload=20?= =?UTF-8?q?=E5=86=85=E3=81=AE=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=AB?= =?UTF-8?q?=E6=88=BB=E3=82=8A=E5=80=A4=E3=82=92=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/preloads/view.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/preloads/view.ts b/src/preloads/view.ts index cb0c3de..7ec4cb5 100644 --- a/src/preloads/view.ts +++ b/src/preloads/view.ts @@ -2,7 +2,15 @@ import { contextBridge, ipcRenderer } from 'electron'; import { IFlastAPI } from '../@types/electron'; import { APPLICATION_PROTOCOL } from '../constants'; import { IPCChannel } from '../constants/ipc'; -import { BookmarkData, OmitData, UserConfig } from '../interfaces/user'; +import { + BookmarkData, + DownloadData, + HistoryData, + HistoryGroup, + NativeDownloadData, + OmitData, + UserConfig +} from '../interfaces/user'; import { DeepPartial } from '../utils'; import { injectChromeWebStoreInstallButton } from './chrome-webstore'; @@ -78,25 +86,25 @@ const api: IFlastAPI = { return ipcRenderer.invoke(IPCChannel.Bookmarks.UPDATE(userId), bookmarkId, data); }, - getHistory: (userId: string) => { + getHistory: (userId: string): Promise => { if (window.location.protocol !== `${APPLICATION_PROTOCOL}:`) return Promise.reject(); - if (!userId) return Promise.resolve(); + if (!userId) return Promise.resolve([]); return ipcRenderer.invoke(IPCChannel.History.LIST(userId)); }, - getHistoryGroups: (userId: string) => { + getHistoryGroups: (userId: string): Promise => { if (window.location.protocol !== `${APPLICATION_PROTOCOL}:`) return Promise.reject(); - if (!userId) return Promise.resolve(); + if (!userId) return Promise.resolve([]); return ipcRenderer.invoke(IPCChannel.History.LIST_GROUPS(userId)); }, - getDownloads: (userId: string) => { + getDownloads: (userId: string): Promise => { if (window.location.protocol !== `${APPLICATION_PROTOCOL}:`) return Promise.reject(); - if (!userId) return Promise.resolve(); + if (!userId) return Promise.resolve([]); return ipcRenderer.invoke(IPCChannel.Downloads.LIST(userId)); }, - getDownloadsWithFileIcon: (userId: string) => { + getDownloadsWithFileIcon: (userId: string): Promise => { if (window.location.protocol !== `${APPLICATION_PROTOCOL}:`) return Promise.reject(); - if (!userId) return Promise.resolve(); + if (!userId) return Promise.resolve([]); return ipcRenderer.invoke(IPCChannel.Downloads.LIST_WITH_FILE_ICON(userId)); } };