arrakis
Version:
Helpfull development framework
23 lines (17 loc) • 554 B
JavaScript
const EventEmitter = require('events');
module.exports = class Platform{
constructor(){
// Services SubFunctions
this.service.parent = this;
this.service.register = function(sid, object, override=false){
if(typeof this.parent[sid] !== 'undefined' && !override)
throw new Error('Service ['+sid+'] already exited, you should override it!');
this.parent[sid] = object;
}
}
service(sid){
if(typeof this[sid] === 'undefined')
throw new Error('Service ['+sid+'] don\'t registed!');
return this[sid];
}
}