|
329 | 329 | } |
330 | 330 | }); |
331 | 331 |
|
332 | | - let alertStr = "Alert", confirmStr = "Confirm"; |
333 | | - |
334 | | - function alertPatch(message) { |
335 | | - // in tauri windows, only the prompt API works. so we use it for alerts as well |
336 | | - // we cant use html alerts here as the alert api will pause js which we cant do via js alone. |
337 | | - prompt(alertStr, message); |
338 | | - } |
339 | | - |
340 | | - function confirmPatch(message) { |
341 | | - // in tauri windows, only the prompt API works. so we use it for confirm as well |
342 | | - // we cant use html alerts here as the alert api will pause js which we cant do via js alone. |
343 | | - const response = prompt(confirmStr, message); |
344 | | - // prompt will return null if cancel is pressed |
345 | | - return !!response; |
346 | | - } |
347 | | - |
348 | 332 | // this is for managing who am i context in iframes embedded in phoenix to have special handling. |
349 | 333 | window.addEventListener('message', function(event) { |
350 | 334 | if (!TRANSPORT_CONFIG.TRUSTED_ORIGINS_EMBED[event.origin]) { |
351 | 335 | return; // Ignore messages from unexpected origins |
352 | 336 | } |
353 | 337 | if(event.data.type === "WHO_AM_I_RESPONSE") { |
354 | 338 | window.__PHOENIX_EMBED_INFO = { |
355 | | - isTauri: event.data.isTauri |
| 339 | + isTauri: event.data.isTauri, |
| 340 | + platform: event.data.platform |
356 | 341 | }; |
357 | | - alertStr = event.data.alertStr || alertStr; |
358 | | - confirmStr = event.data.confirmStr || confirmStr; |
359 | | - if(event.data.isTauri && event.data.platform === 'win') { |
360 | | - // patch alert and confirm as in windows iframes in tauri, these are not present. |
361 | | - window.alert = alertPatch; |
362 | | - window.confirm = confirmPatch; |
363 | | - } |
364 | 342 | } |
365 | 343 | }); |
366 | 344 | if(window.self !== window.parent){ |
|
0 commit comments