version.js 1.0 KB

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