var UpdatePull = function() { | |
events.EventEmitter.call(this); | |
} | |
util.inherits(UpdatePull, events.EventEmitter); | |
UpdatePull.prototype.pull = function() { | |
var self = this; | |
this.rsspull(function(result){ | |
_.each(result, (function(item){ | |
console.log(item.hash); | |
console.log(rssfeed_backlog.item); | |
var findeditem = _.findWhere(rssfeed_backlog, {hash: item.hash}); | |
if(typeof findeditem == "undefined") { | |
rssfeed_backlog.push(item); | |
self.emit("articles", item); | |
//dontwork TypeError: Cannot call method 'emit' of undefined | |
} | |
console.log(_.findWhere(rssfeed_backlog, {hash: item.md5})); | |
}).bind(this)); | |
} , 10); | |
var data = ["data1", "data2"]; | |
self.emit("articles", data); | |
} | |
var updatePull = new UpdatePull(); | |
updatePull.pull() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment