Given this var:
somevar = {dothis: function(){console('yay')}};
If I want to hijack it, I would think i’d do something like:
tempvar = somevar;
somevar = function(){ console.log('yoink'); tempvar();};
But if I know that the var is going to be redefined in 60 seconds, and I want to hijack it in 65 seconds, how do I do that? Wouldn’t a setTimeout parse the function immediately, and then refer to the old hijacked function?
Thanks in advance.
Try something like this:
demo: http://jsfiddle.net/MDLZt/