-
-
Save nedcampion/4625073 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
request = function(url, func ){ | |
setTimeout(function(){ | |
console.log("REQUEST", url, func); | |
func(); | |
}, 1); | |
} | |
function Source(url){ | |
this.url = url; | |
this.morelinks = ['NO CHANGE']; | |
var self = this; | |
this.calculate = function(url){ | |
console.log("Calculating: " + self.url); | |
console.log('1: ' + self.morelinks) | |
var parse = function(err,resp,body){ | |
console.log('3: ' + self.morelinks) | |
self.morelinks.push("ADDED ONE"); | |
} | |
request(self.url, parse); | |
console.log('4: ' + myResults.morelinks) | |
} | |
} | |
myResults = new Source('http://www.reddit.com/r/videos'); | |
myResults.calculate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment