我试图使用显式的 .bind(this) 并且没有用。我也知道箭头功能在这里不起作用。
'use strict';
const co = require('co');
class ServiceDemo {
constructor(repository, config, loggingService) {
this.config = config;
this.repository = repository;
this.loggingService = loggingService;
}
checkForNotifications(pricePoint) {
const self = this;
return co(function*() {
self.loggingService.debug('test');
//const surprisesToNotify = yield this.getSomething(pricePoint);
});
}
getSomething(){
return co(function*() {
return {};
});
}
}
module.exports = SurpriseSchedulerService;