|
237 | 237 | return window.__TAURI__.core.invoke; |
238 | 238 | } |
239 | 239 |
|
240 | | - function invokeTauriWithTimeout(invoke, command, args, timeoutMs) { |
| 240 | + function invokeTauriWithTimeout(invokeCall, commandLabel, timeoutMs) { |
241 | 241 | return new Promise((resolve, reject) => { |
242 | 242 | let settled = false; |
243 | 243 | const timer = setTimeout(() => { |
244 | 244 | if (settled) { |
245 | 245 | return; |
246 | 246 | } |
247 | 247 | settled = true; |
248 | | - reject(new Error(`Tauri invoke timed out (${command}).`)); |
| 248 | + reject(new Error(`Tauri invoke timed out (${commandLabel}).`)); |
249 | 249 | }, timeoutMs); |
250 | 250 |
|
251 | | - Promise.resolve(invoke(command, args)) |
| 251 | + Promise.resolve(invokeCall()) |
252 | 252 | .then((result) => { |
253 | 253 | if (settled) { |
254 | 254 | return; |
|
281 | 281 |
|
282 | 282 | try { |
283 | 283 | const caps = await invokeTauriWithTimeout( |
284 | | - invoke, |
| 284 | + () => invoke('get_runtime_capabilities'), |
285 | 285 | 'get_runtime_capabilities', |
286 | | - undefined, |
287 | 286 | TAURI_RUNTIME_HYDRATE_TIMEOUT_MS |
288 | 287 | ); |
289 | 288 | if (caps && typeof caps === 'object') { |
|
296 | 295 | const runtimeCaps = window.__NC_RUNTIME_CAPS || {}; |
297 | 296 | if (runtimeCaps.supports_sidecar) { |
298 | 297 | const runtimeConfig = await invokeTauriWithTimeout( |
299 | | - invoke, |
| 298 | + () => invoke('get_sidecar_runtime_config'), |
300 | 299 | 'get_sidecar_runtime_config', |
301 | | - undefined, |
302 | 300 | TAURI_RUNTIME_HYDRATE_TIMEOUT_MS |
303 | 301 | ); |
304 | 302 | setRuntimeConfig(runtimeConfig); |
|
0 commit comments