Skip to content

Instantly share code, notes, and snippets.

@brettcave
Created November 27, 2013 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettcave/7672829 to your computer and use it in GitHub Desktop.
Save brettcave/7672829 to your computer and use it in GitHub Desktop.
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