utils.js 801 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. const { Controller } = require('ee-core');
  3. const { shell } = require('electron');
  4. const Log = require('ee-core/log');
  5. /**
  6. * example
  7. * @class
  8. */
  9. class UtilsController extends Controller {
  10. constructor(ctx) {
  11. super(ctx);
  12. }
  13. /**
  14. * 所有方法接收两个参数
  15. * @param args 前端传的参数
  16. * @param event - ipc通信时才有值。详情见:控制器文档
  17. */
  18. /**
  19. * upload
  20. */
  21. async openFileFolder (params) {
  22. // const result = await Services.get('example').test('electron');
  23. Log.info(params)
  24. Log.info(decodeURIComponent(params))
  25. shell.openPath(params);
  26. }
  27. async shellFun (params) {
  28. shell[params.action](params.params)
  29. }
  30. }
  31. UtilsController.toString = () => '[class ExampleController]';
  32. module.exports = UtilsController;