[submodule:helpers] Revert providing extra param in isAppleSilicon() and just check for window instead

This commit is contained in:
Faisal Salman 2024-11-16 19:22:43 +07:00
parent 2b125c8de4
commit b1c7dfcc3a

View File

@ -15,12 +15,12 @@ const { isStandalonePWA } = require('is-standalone-pwa');
const getDeviceVendor = (model) => UAParser(`Mozilla/5.0 (Linux; Android 10; ${model}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36`).device.vendor; const getDeviceVendor = (model) => UAParser(`Mozilla/5.0 (Linux; Android 10; ${model}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36`).device.vendor;
const isAppleSilicon = (res, useFeatureDetection) => { const isAppleSilicon = (res) => {
if (res.os.is(OS.MACOS)) { if (res.os.is(OS.MACOS)) {
if (res.cpu.is(CPU.ARM)) { if (res.cpu.is(CPU.ARM)) {
return true; return true;
} }
if (useFeatureDetection) { if (typeof window !== 'undefined') {
try { try {
const canvas = document.createElement('canvas'); const canvas = document.createElement('canvas');
const webgl = canvas.getContext('webgl2') || canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); const webgl = canvas.getContext('webgl2') || canvas.getContext('webgl') || canvas.getContext('experimental-webgl');