Update: 音效播放功能
This commit is contained in:
@ -1,7 +1,13 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron')
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
playSound: (soundFile) => ipcRenderer.send('play-sound', soundFile),
|
||||
playSound: (soundFile) => {
|
||||
try {
|
||||
ipcRenderer.send('play-sound', soundFile)
|
||||
} catch (err) {
|
||||
console.error('播放音效失败:', err)
|
||||
}
|
||||
},
|
||||
showTooltip: (text) => ipcRenderer.send('show-tooltip', text),
|
||||
onUpdatePosition: (callback) => {
|
||||
ipcRenderer.on('update-position', (_, position) => callback(position))
|
||||
|
Reference in New Issue
Block a user