version.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.canIUseModel = canIUseModel;
  6. exports.canIUseFormFieldButton = canIUseFormFieldButton;
  7. exports.canIUseAnimate = canIUseAnimate;
  8. var _utils = require("./utils");
  9. function compareVersion(v1, v2) {
  10. v1 = v1.split(".");
  11. v2 = v2.split(".");
  12. var len = Math.max(v1.length, v2.length);
  13. while (v1.length < len) {
  14. v1.push("0");
  15. }
  16. while (v2.length < len) {
  17. v2.push("0");
  18. }
  19. for (var i = 0; i < len; i++) {
  20. var num1 = parseInt(v1[i], 10);
  21. var num2 = parseInt(v2[i], 10);
  22. if (num1 > num2) {
  23. return 1;
  24. }
  25. if (num1 < num2) {
  26. return -1;
  27. }
  28. }
  29. return 0;
  30. }
  31. function canIUseModel() {
  32. var system = (0, _utils.getSystemInfoSync)();
  33. return compareVersion(system.SDKVersion, "2.9.3") >= 0;
  34. }
  35. function canIUseFormFieldButton() {
  36. var system = (0, _utils.getSystemInfoSync)();
  37. return compareVersion(system.SDKVersion, "2.10.3") >= 0;
  38. }
  39. function canIUseAnimate() {
  40. var system = (0, _utils.getSystemInfoSync)();
  41. return compareVersion(system.SDKVersion, "2.9.0") >= 0;
  42. }