ADD: 模块激活流程
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const { Controller } = require('ee-core');
|
||||
const Log = require('ee-core/log');
|
||||
const Services = require('ee-core/services');
|
||||
|
||||
/**
|
||||
* example
|
||||
* @class
|
||||
*/
|
||||
class ExampleController extends Controller {
|
||||
|
||||
constructor(ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 所有方法接收两个参数
|
||||
* @param args 前端传的参数
|
||||
* @param event - ipc通信时才有值。详情见:控制器文档
|
||||
*/
|
||||
|
||||
/**
|
||||
* test
|
||||
*/
|
||||
async test () {
|
||||
const result = await Services.get('example').test('electron');
|
||||
Log.info('service result:', result);
|
||||
|
||||
return 'hello electron-egg';
|
||||
}
|
||||
}
|
||||
|
||||
ExampleController.toString = () => '[class ExampleController]';
|
||||
module.exports = ExampleController;
|
||||
@@ -1,29 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const { Service } = require('ee-core');
|
||||
|
||||
/**
|
||||
* 示例服务(service层为单例)
|
||||
* @class
|
||||
*/
|
||||
class ExampleService extends Service {
|
||||
|
||||
constructor(ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* test
|
||||
*/
|
||||
async test(args) {
|
||||
let obj = {
|
||||
status:'ok',
|
||||
params: args
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
ExampleService.toString = () => '[class ExampleService]';
|
||||
module.exports = ExampleService;
|
||||
Reference in New Issue
Block a user