[Greasemonkey] screw it... 0.2.7b - with jeremy's checkbox thang

Edward Lee edilee at gmail.com
Fri Apr 8 14:13:22 EDT 2005

Just to extend on that a bit, but not quite like Aaron's creating a
global (window) function..

(function() {
  var a = '!';
  function t(i) {
    alert('Hello ' + i + a);
  setTimeout(function() { t('world') }, 1000);

It does indeed alert "Hello world!" while leaving "a" and "t"
undefined outside of the anonymous function wrapper. It's kinda
interesting that with the function wrapper around "t('world')", the
evaluation is delayed, but it's still able to correctly access the
function t and variable a.


More information about the Greasemonkey mailing list