platform-utils.js 876B

123456789101112131415161718192021222324
  1. export function isCordova(plt) {
  2. const win = plt.win();
  3. return !!(win['cordova'] || win['PhoneGap'] || win['phonegap']);
  4. }
  5. export function isElectron(plt) {
  6. return plt.testUserAgent('Electron');
  7. }
  8. export function isIos(plt) {
  9. // shortcut function to be reused internally
  10. // checks navigator.platform to see if it's an actual iOS device
  11. // this does not use the user-agent string because it is often spoofed
  12. // an actual iPad will return true, a chrome dev tools iPad will return false
  13. return plt.testNavigatorPlatform('iphone|ipad|ipod');
  14. }
  15. export function isSafari(plt) {
  16. return plt.testUserAgent('Safari');
  17. }
  18. export function isWKWebView(plt) {
  19. return isIos(plt) && !!plt.win()['webkit'];
  20. }
  21. export function isIosUIWebView(plt) {
  22. return isIos(plt) && !isWKWebView(plt) && !isSafari(plt);
  23. }
  24. //# sourceMappingURL=platform-utils.js.map