Created
November 27, 2013 09:10
-
-
Save brettcave/7672829 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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