I'm trying to be a good citizen and keep as much out of the global scope as possible. Is there a way to access setTimeout variables that are not in the global scope?
So that, in this example how would someone cancel 'timer'?
myObject.timedAction = (function(){
    var timer;
        return function(){
            // do stuff
            // then wait & repeat       
            timer = setTimeout(myObject.timedAction,1000);
        };
})();
I've tried clearTimeout(myObject.timedAction.timer,1000); (without success), and not sure what else to try.
 
     
    