Update wkPage.ts

Signed-off-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
Max Schmitt 2024-06-12 15:00:22 +02:00 committed by GitHub
parent 8be9e0d0a0
commit 743ff4ff4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -716,7 +716,10 @@ export class WKPage implements PageDelegate {
const angle = viewportSize.width > viewportSize.height ? 90 : 0; const angle = viewportSize.width > viewportSize.height ? 90 : 0;
// Special handling for macOS 12. // Special handling for macOS 12.
const useLegacySetOrientationOverrideMethod = os.platform() === 'darwin' && parseInt(os.release().split('.')[0], 10) <= 21; const useLegacySetOrientationOverrideMethod = os.platform() === 'darwin' && parseInt(os.release().split('.')[0], 10) <= 21;
promises.push(this._pageProxySession.send(useLegacySetOrientationOverrideMethod ? 'Page.setOrientationOverride' as any : 'Emulation.setOrientationOverride', { angle })); if (useLegacySetOrientationOverrideMethod)
promises.push(this._session.send('Page.setOrientationOverride' as any, { angle }));
else
promises.push(this._pageProxySession.send('Emulation.setOrientationOverride', { angle }));
} }
await Promise.all(promises); await Promise.all(promises);
} }