[Greasemonkey] Execution Order - q on addEvenListener

Nikolas Coukouma lists at atrus.org
Tue Aug 16 18:12:43 EDT 2005


Chris Hayes wrote:

> The reason to add a function the way i did is because I needed to call
> some functions from links I added to a forum: so I cannot call a
> function that's within the GM scope. 

Maybe I'm missing something, but I think JavaScript scoping handles this
for you. Functions carry around their scope. For example, the following
works just fine:

function bar() {
  alert("hi");
}
function foo() {
  bar();
}
document.addEventListener("load", foo, false);


More information about the Greasemonkey mailing list