1
我試圖在nodejs中增加一個模塊。當我打電話超級只有一次,它的確定,但是當我開始它調用其他代碼點,從一個數據是在另一個...繼承nodejs
RegEvent.js(超)
var __ = require('lodash');
var RegEvent = function() {
RegEvent.prototype.Model = new require('models/regValids')(this.model);
};
RegEvent.prototype.getAll = function() {
var self = this;
var args = Array.prototype.slice.call(arguments, 0);
var callback = args.pop();
getAll(self, args[0], args[1] || {}, args[2] || {}, callback);
};
var getAll = function (scope, company, where, projection, callback) {
scope.Model.get(company, where, projection, function (error, result) {
return callback(error, result);
});
};
module.exports = RegEvent;
configPerEmployee .js文件
var __ = require('lodash');
var inherits = require('util').inherits;
var RegEvent = require('components/regEvent');
var ConfigPerEmployee = function() {
this.model = 'config_employees';
RegEvent.apply(this, arguments);
};
inherits(ConfigPerEmployee, RegEvent);
ConfigPerEmployee.prototype.handlePriority = function (company, employee, callback) {
...
}
所以,我還有一個模塊稱爲時間表(如configPerEmployee.js)繼承RegEvents,當我打電話從日程安排,我從configPerEmployee訪問模式。我不知道什麼是錯的。
我猜這個節點與ES6會更容易得到這種行爲,因爲你可以創建類 – ackuser