project created
This commit is contained in:
+7
-23
@@ -1,26 +1,10 @@
|
||||
// preload.js
|
||||
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
// Expose protected methods that allow the renderer process to use
|
||||
// the ipcRenderer without exposing the entire object
|
||||
// Expose a limited set of IPC methods to the renderer process
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
onIsSteamOS: (callback) => ipcRenderer.on('is-steam-os', (_event, value) => callback(value)),
|
||||
|
||||
// Bookmark API
|
||||
getBookmarks: () => ipcRenderer.invoke('get-bookmarks'),
|
||||
addBookmark: (bookmark) => ipcRenderer.invoke('add-bookmark', bookmark),
|
||||
removeBookmark: (url) => ipcRenderer.invoke('remove-bookmark', url),
|
||||
|
||||
// Home Bookmark API
|
||||
getHomeBookmarks: () => ipcRenderer.invoke('get-home-bookmarks'),
|
||||
addHomeBookmark: (bookmark) => ipcRenderer.invoke('add-home-bookmark', bookmark),
|
||||
removeHomeBookmark: (url) => ipcRenderer.invoke('remove-home-bookmark', url),
|
||||
});
|
||||
|
||||
contextBridge.exposeInMainWorld('settingsAPI', {
|
||||
clearCookies: () => ipcRenderer.invoke('clear-cookies'),
|
||||
goHome: () => ipcRenderer.invoke('go-home'),
|
||||
clearBookmarks: () => ipcRenderer.invoke('clear-bookmarks'),
|
||||
clearHomeBookmarks: () => ipcRenderer.invoke('clear-home-bookmarks'),
|
||||
});
|
||||
loadURL: (url) => ipcRenderer.send('load-url', url),
|
||||
goBack: () => ipcRenderer.send('go-back'),
|
||||
goForward: () => ipcRenderer.send('go-forward'),
|
||||
refreshPage: () => ipcRenderer.send('refresh-page'),
|
||||
// You can add more APIs here as your browser grows
|
||||
});
|
||||
Reference in New Issue
Block a user