@@ -12,7 +12,10 @@ export interface WebContextBridgeApi {
1212 // Mock IPC methods
1313 send : ( channel : ClientEventChannel , ...args : unknown [ ] ) => void ;
1414 handleOnce : < T = unknown > ( channel : ServerEventChannel , callback : ( payload : T ) => void ) => void ;
15- waitForResponse : < T = unknown > ( channel : ServerEventChannel ) => Promise < T > ;
15+ waitForResponse : < T = unknown > (
16+ channel : ServerEventChannel ,
17+ timeoutMs ?: number ,
18+ ) => ( ) => Promise < T > ;
1619
1720 // File operations
1821 getFilePath : ( file : File | null | undefined ) => string | undefined ;
@@ -23,18 +26,6 @@ class WebApi implements WebContextBridgeApi {
2326
2427 private pendingCallbacks = new Map < string , ( ( payload : unknown ) => void ) [ ] > ( ) ;
2528
26- // constructor() {
27- // // Detect actual platform if possible
28- // const userAgent = navigator.userAgent.toLowerCase();
29- // if (userAgent.includes("mac")) {
30- // this.platform = "darwin";
31- // } else if (userAgent.includes("win")) {
32- // this.platform = "win32";
33- // } else if (userAgent.includes("linux")) {
34- // this.platform = "linux";
35- // }
36- // }
37-
3829 send ( channel : ClientEventChannel , ...args : unknown [ ] ) : void {
3930 console . warn ( `[WebApi] IPC send called with channel: ${ String ( channel ) } ` , args ) ;
4031 // In a real implementation, this could send requests to a backend API
@@ -48,10 +39,11 @@ class WebApi implements WebContextBridgeApi {
4839 this . pendingCallbacks . set ( channelKey , callbacks ) ;
4940 }
5041
51- async waitForResponse < T = unknown > ( channel : ServerEventChannel ) : Promise < T > {
42+ waitForResponse < T = unknown > ( channel : ServerEventChannel , _timeoutMs = 0 ) : ( ) => Promise < T > {
5243 console . warn ( `[WebApi] IPC waitForResponse called with channel: ${ String ( channel ) } ` ) ;
53- // Return a rejected promise for now - in a real implementation this would wait for backend response
54- return Promise . reject ( new Error ( `Web API does not support IPC channel: ${ String ( channel ) } ` ) ) ;
44+ // Return a function that returns a rejected promise for now - in a real implementation this would wait for backend response
45+ return ( ) =>
46+ Promise . reject ( new Error ( `Web API does not support IPC channel: ${ String ( channel ) } ` ) ) ;
5547 }
5648
5749 getFilePath ( file : File | null | undefined ) : string | undefined {
0 commit comments