Don't access "document" in WebWorker

Fixes https://github.com/google/mediapipe/issues/4694

PiperOrigin-RevId: 557885230
This commit is contained in:
Sebastian Schmidt 2023-08-17 11:30:23 -07:00 committed by Copybara-Service
parent ed0c8d8d8b
commit 990bfd2e3e

View File

@ -32,5 +32,6 @@ export function isIOS() {
// tslint:disable-next-line:deprecation
].includes(navigator.platform)
// iPad on iOS 13 detection
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
|| (navigator.userAgent.includes('Mac') &&
(typeof document !== undefined && 'ontouchend' in document));
}