Skip to content

Instantly share code, notes, and snippets.

@addywaddy
Created January 13, 2010 14:13
Show Gist options
  • Save addywaddy/276213 to your computer and use it in GitHub Desktop.
Save addywaddy/276213 to your computer and use it in GitHub Desktop.
get = function(callback) {
print("WRONG")
callback()
}
var resource = function(name, callback) {
var get = function(callback) {
print("CORRECT")
callback()
}
// Declaring the function here gives me access to the locally defined get function
var func = function() {
get(function() {
print("OK")
})
}
func()
// How can I get callback to use the locally defined function instead of the global one?
callback()
}
resource("foo", function() {
get(function() {
print("YEAH")
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment