mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-11-16 07:02:16 +03:00
Update version to 2.0.0-rc.3
This commit is contained in:
2
src/helpers/ua-parser-helpers.d.ts
vendored
2
src/helpers/ua-parser-helpers.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.2
|
||||
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.3
|
||||
// Project: https://github.com/faisalman/ua-parser-js
|
||||
// Definitions by: Faisal Salman <https://github.com/faisalman>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////
|
||||
/* Helpers for UAParser.js v2.0.0-rc.2
|
||||
/* Helpers for UAParser.js v2.0.0-rc.3
|
||||
https://github.com/faisalman/ua-parser-js
|
||||
Author: Faisal Salman <f@faisalman.com>
|
||||
AGPLv3 License */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Source: /src/helpers/ua-parser-helpers.js
|
||||
|
||||
///////////////////////////////////////////////
|
||||
/* Helpers for UAParser.js v2.0.0-rc.2
|
||||
/* Helpers for UAParser.js v2.0.0-rc.3
|
||||
https://github.com/faisalman/ua-parser-js
|
||||
Author: Faisal Salman <f@faisalman.com>
|
||||
AGPLv3 License */
|
||||
@@ -19,27 +19,29 @@ import { isStandalonePWA } from '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 isAppleSilicon = (res) => {
|
||||
const isAppleSilicon = (res, useFeatureDetection) => {
|
||||
if (res.os.is(OS.MACOS)) {
|
||||
if (res.cpu.is(CPU.ARM)) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const canvas = document.createElement('canvas');
|
||||
const webgl = canvas.getContext('webgl2') || canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
|
||||
const debug = webgl.getExtension('WEBGL_debug_renderer_info');
|
||||
const renderer = webgl.getParameter(debug.UNMASKED_RENDERER_WEBGL);
|
||||
if (renderer.match(/apple m\d/i)) {
|
||||
return true;
|
||||
if (useFeatureDetection) {
|
||||
try {
|
||||
const canvas = document.createElement('canvas');
|
||||
const webgl = canvas.getContext('webgl2') || canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
|
||||
const debug = webgl.getExtension('WEBGL_debug_renderer_info');
|
||||
const renderer = webgl.getParameter(debug.UNMASKED_RENDERER_WEBGL);
|
||||
if (renderer.match(/apple m\d/i)) {
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const isBot = (res) => ['cli', 'crawler', 'fetcher', 'module'].includes(res.browser.type);
|
||||
const isBot = (res) => ['cli', 'crawler', 'fetcher', 'library'].includes(res.browser.type);
|
||||
|
||||
const isChromeFamily = (res) => res.engine.is(Engine.BLINK);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user