-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #470 from kdvalin/flying-control-fixes
Flying Control Fixes
- Loading branch information
Showing
1 changed file
with
6 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,12 @@ | ||
import { UAParser } from "ua-parser-js"; | ||
|
||
const MOBILE_TYPES = [ | ||
"mobile", | ||
"tablet", | ||
"wearable" | ||
]; | ||
import AFRAME from "aframe"; | ||
|
||
export const browserType = () => { | ||
let parser = new UAParser(); | ||
const device = parser.getDevice(); | ||
const device = AFRAME.utils.device; | ||
|
||
if("xr" in navigator) { | ||
return "vr"; | ||
} | ||
else if("getVRDisplays" in navigator && navigator.getVRDisplays().length > 0) { | ||
return "vr"; | ||
} | ||
else if(MOBILE_TYPES.indexOf(device.type) === -1) { | ||
return "desktop"; | ||
} | ||
else { | ||
if(device.isMobile()) { | ||
return "mobile"; | ||
}else if(device.getVRDisplay() && device.getVRDisplay().length >= 0) { | ||
return "vr"; | ||
} | ||
return "desktop"; | ||
}; |