您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Platform.web.js 886B

1234567891011121314151617181920212223242526272829303132333435
  1. /* @flow */
  2. const { userAgent, maxTouchPoints, platform } = navigator;
  3. let OS;
  4. if (userAgent.match(/Android/i)) {
  5. OS = 'android';
  6. } else if (userAgent.match(/iP(ad|hone|od)/i) || (maxTouchPoints && maxTouchPoints > 2 && /MacIntel/.test(platform))) {
  7. OS = 'ios';
  8. } else if (userAgent.match(/Mac(intosh| OS X)/i)) {
  9. OS = 'macos';
  10. } else if (userAgent.match(/Windows/i)) {
  11. OS = 'windows';
  12. }
  13. /**
  14. * Provides a minimal equivalent of react-native's Platform abstraction.
  15. */
  16. export default {
  17. /**
  18. * The operating system on which the application is executing.
  19. *
  20. * @type {string}
  21. */
  22. OS,
  23. /**
  24. * The operating system version on which the application is executing.
  25. * This is intentionally set to undefined so we can tell mobile and mobile web
  26. * apart easier.
  27. *
  28. * @type {number|undefined}
  29. */
  30. Version: undefined
  31. };