import { Controller , IpcInvoke , IpcOn } from '../decorators' ; import { MyService } from '../Services/MyService' ; import { EVENTS } from '@common/events' ; @ Controller ( ) export class MyController { constructor ( private myService ) { } @ IpcOn ( EVENTS . REPLY_MSG ) public replyMsg ( msg ) { return `${ this . myService . getDelayTime ( ) } seconds later, the main process replies to your message: ${ msg }` ; } @ IpcInvoke ( EVENTS . SEND_MSG ) public async handleSendMsg ( msg ) { setTimeout ( ( ) => { this . replyMsg ( msg ) ; } , this . myService . getDelayTime ( ) * 1000 ) ; return `The main process received your message: ${ msg }` ; } }