Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SSR (Reopen #9317) #9385

Merged
merged 9 commits into from
Jul 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add check if property exists (Deno support)
  • Loading branch information
Falke-Design committed Jul 2, 2024
commit 476de2f31d786a89467e4cc88478894c3f2f8ab1
8 changes: 4 additions & 4 deletions src/core/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ const touch = touchNative || pointer;

// @property retina: Boolean
// `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
const retina = typeof window === 'undefined' ? false : (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;
const retina = typeof window === 'undefined' || typeof window.devicePixelRatio === 'undefined' ? false : window.devicePixelRatio > 1;

// @property mac: Boolean; `true` when the browser is running in a Mac platform
const mac = typeof navigator === 'undefined' ? false : (navigator?.platform ?? '').startsWith('Mac');
const mac = typeof navigator === 'undefined' || typeof navigator.platform === 'undefined' ? false : navigator.platform.startsWith('Mac');

// @property mac: Boolean; `true` when the browser is running in a Linux platform
const linux = typeof navigator === 'undefined' ? false : (navigator?.platform ?? '').startsWith('Linux');
const linux = typeof navigator === 'undefined' || typeof navigator.platform === 'undefined' ? false : navigator.platfom.startsWith('Linux');

function userAgentContains(str) {
if (typeof navigator === 'undefined') {
if (typeof navigator === 'undefined' || typeof navigator.userAgent === 'undefined') {
return false;
}
return navigator.userAgent.toLowerCase().includes(str);
Expand Down