mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 18:46:17 +00:00
os: add isAndroid() function
This will be used to test if the app is running on Android.
This commit is contained in:
committed by
David Lechner
parent
a0130ada99
commit
56c739fa08
@@ -3,6 +3,17 @@
|
||||
|
||||
// Utility functions for dealing with operating systems.
|
||||
|
||||
// TODO: replace with navigator.userAgentData when it is more widely available
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API
|
||||
|
||||
/**
|
||||
* Tests if we are running on Android.
|
||||
* @returns `true` if running on Android, otherwise `false`.
|
||||
*/
|
||||
export function isAndroid(): boolean {
|
||||
return /android/i.test(navigator.userAgent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if we are running on macOS.
|
||||
* @returns `true` if running on macOS, otherwise `false`.
|
||||
|
||||
Reference in New Issue
Block a user