eazy-pomelo
Version:
NetEase Pomelo Of EazyGame OEM
36 lines (29 loc) • 844 B
JavaScript
var ConnectionService = require('../common/service/connectionService');
/**
* Connection component for statistics connection status of frontend servers
*/
module.exports = function(app) {
return new Component(app);
};
var Component = function(app) {
this.app = app;
this.service = new ConnectionService(app);
// proxy the service methods except the lifecycle interfaces of component
var method, self = this;
var getFun = function(m) {
return (function() {
return function() {
return self.service[m].apply(self.service, arguments);
};
})();
};
for(var m in this.service) {
if(m !== 'start' && m !== 'stop') {
method = this.service[m];
if(typeof method === 'function') {
this[m] = getFun(m);
}
}
}
};
Component.prototype.name = '__connection__';