35 lines
882 B
JavaScript
35 lines
882 B
JavaScript
'use strict';
|
|
|
|
const Repository = require('../Repository');
|
|
const Interfaces = require('../Interfaces');
|
|
|
|
class Company {
|
|
constructor(){
|
|
this.Events = {
|
|
/** Event_Id : callback */
|
|
"Example" : this.event_handler_example
|
|
};
|
|
}
|
|
|
|
init(){
|
|
/// Setup application events
|
|
const Events = this.Events;
|
|
/// Setup application events
|
|
for ( const [event, callback] of Object.entries( Events ) ) {
|
|
const event_id = Interfaces.ModuleName + event
|
|
Interfaces.registerEvent( event_id , callback );
|
|
}
|
|
}
|
|
|
|
trigger_example_event( data ){
|
|
Interfaces.publishEvent( "Example", data );
|
|
}
|
|
|
|
event_handler_example( data ){
|
|
console.log( "CompanyDomain event" );
|
|
console.log( data );
|
|
}
|
|
};
|
|
|
|
module.exports = new Company();
|