( type: string, payload: any, webview: Electron.WebContents, win: BrowserWindow )
| 4 | import { BrowserWindow } from 'electron'; |
| 5 | |
| 6 | export function handleTailchatMessage( |
| 7 | type: string, |
| 8 | payload: any, |
| 9 | webview: Electron.WebContents, |
| 10 | win: BrowserWindow |
| 11 | ) { |
| 12 | log.info('onMessage receive:', type, payload); |
| 13 | |
| 14 | if (type === 'init') { |
| 15 | webview.executeJavaScript(generateInstallPluginScript()); |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | if (type === 'callScreenshotsTool') { |
| 20 | startScreenshots(); |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | if (type === 'receiveUnmutedMessage') { |
| 25 | if (!win.isFocused()) { |
| 26 | win.flashFrame(true); |
| 27 | } |
| 28 | return; |
| 29 | } |
| 30 | } |
no test coverage detected