helper.js 816 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict';
  2. const is = require('electron-is');
  3. const { app } = require('electron');
  4. /**
  5. * application quit
  6. *
  7. * @return {undefined}
  8. */
  9. exports.appQuit = function () {
  10. MAIN_WINDOW.destroy();
  11. app.quit();
  12. }
  13. /**
  14. * get Platform
  15. *
  16. * @return {Object}
  17. */
  18. exports.getPlatform = function () {
  19. let platform = null;
  20. let arch = null;
  21. if (is.windows()) {
  22. platform = 'windows';
  23. } else if (is.macOS()) {
  24. platform = 'macOS';
  25. } else if (is.linux()) {
  26. platform = 'linux';
  27. } else {
  28. platform = 'other';
  29. }
  30. if (is.x86()) {
  31. arch = '32';
  32. } else if (is.x64()) {
  33. arch = '64';
  34. } else if (process.arch == 'arm') {
  35. arch = 'arm32';
  36. } else if (process.arch == 'arm64') {
  37. arch = 'arm64';
  38. } else {
  39. arch = 'other';
  40. }
  41. const platfromObj = {
  42. platform: platform,
  43. arch: arch
  44. };
  45. return platfromObj;
  46. }