Introduction
like most frameworks, it receives front-end requests, organizes parameters, and calls Service to process services.
Example
const Controller = require('ee-core').Controller;
/**
* example
* @class
*/
class ExampleController extends Controller {
constructor(ctx) {
super(ctx);
}
/**
* All methods receive two parameters
* @param args Parameters transmitted by the front end
* @param event - IpcMainEvent doc:https://www.electronjs.org/docs/latest/api/structures/ipc-main-event
*/
/**
* test
*/
async test (args, event) {
const params = args;
// call service
const result = await this.service.example.test('ee');
// Actively send a request to the front end
// channel front-end ipc.on(), listening route
const channel = "controller.example.something"
event.reply(channel, {age:21})
const data = {}
return data;
}
}