哆啦好梦 2 gadi atpakaļ
vecāks
revīzija
9fed01c753

+ 15 - 7
electron/jobs/example.js

@@ -1,9 +1,7 @@
-// const Exception = require('ee-core/module/exception');
-// Exception.start();
 const Job = require('ee-core/module/jobs/baseJobClass');
 const Loader = require('ee-core/module/loader');
 const Log = require('ee-core/module/log');
-const Ps = require('ee-core/module/utils/ps');
+const Ps = require('ee-core/module/ps');
 const test = Loader.requireJobsModule('./test');
 
 //tests.hello();
@@ -16,18 +14,28 @@ class ExampleJob extends Job {
 
   constructor(params) {
     super();
+    this.params = params;
   }
 
   /**
    * Execute the job
    */
   async handle () {
-    // logger.info("[renderer] process: ", process);
-    Log.info("[child-process] process type: ", Ps.processType());
-    Log.info("[child-process] process cwd: ", process.cwd());
+    Log.info("[child-process] job params: ", this.params);
+    // setInterval(function() {
+    //   console.log('ddddd')
+    // }, 1000);
 
-    tests.hello();
+    //test.hello();
     //test.utilsMod();
+
+    setTimeout(function(){
+      test.hello();
+    }, 3000)
+
+    setTimeout(function(){
+      Ps.exit(1);
+    }, 10000)
   }   
 }
 

+ 1 - 1
electron/jobs/hello.js

@@ -1,6 +1,6 @@
 const Loader = require('ee-core/module/loader');
 const Log = require('ee-core/module/log');
-const Ps = require('ee-core/module/utils/ps');
+const Ps = require('ee-core/module/ps');
 const test = Loader.requireJobsModule('./test');
 
 

+ 1 - 1
electron/jobs/test.js

@@ -1,6 +1,6 @@
 const Log = require('ee-core/module/log');
 const Utils = require('ee-core/module/utils');
-const Ps = require('ee-core/module/utils/ps');
+const Ps = require('ee-core/module/ps');
 
 exports.hello = function () {
   Log.info('[child-process] [jobs/test] hello -------- ');

+ 7 - 4
electron/preload/index.js

@@ -3,7 +3,7 @@
  *************************************************/
 
 const ChildJob = require('ee-core/module/jobs/child');
-const UtilsPs = require('ee-core/module/utils/ps');
+const Ps = require('ee-core/module/ps');
 const Log = require('ee-core/module/log');
 const test = require('./test');
 
@@ -24,14 +24,17 @@ module.exports = async (app) => {
   awakenAddon.create();
   autoUpdaterAddon.create();
 
-  Log.info("[main] process type: ", UtilsPs.processType());
+  Log.info("[main] process type: ", Ps.processType());
   Log.info("[main] process cwd: ", process.cwd());
 
   test();
 
   let myJob = new ChildJob();
-  //myJob.run('exampleJob', './jobs/example.js');
-  myJob.run('exampleJob', './jobs/hello.js');
+  myJob.exec('./jobs/example.js', {name: 'gsx1'});
+
+  setTimeout(function(){
+    myJob.exec('./jobs/example.js', {name: 'gsx2'});
+  }, 5000)
 
   // let opt2 = {
   //   dev: true,

+ 1 - 1
electron/preload/test.js

@@ -1,6 +1,6 @@
 const Log = require('ee-core/module/log');
 const Utils = require('ee-core/module/utils');
-const Ps = require('ee-core/module/utils/ps');
+const Ps = require('ee-core/module/ps');
 
 module.exports = async () => {