You are probably assuming your code is running in the global scope. It's 
actually being wrapped in a closure. If you want to create a global 
variable or function you need to do so by adding it to the window object.

The old way:

var myVar = 1234;
function myMethod() { alert( 1234 ); };

The new way:

window.myVar = 1234;
window.myMethod = function() { alert( 1234 ); };

- Trevor

On 11/8/10 3:28 PM, Jeroen De Dauw wrote:
> Hey,
>
> I'm doing some effort to use the Resource Loader in the Maps extension. A
> problem I've run into is that I apparently cannot use things defined in
> another module that already loaded. What I'm doing is loading the OpenLayers
> library, and then another JS file that uses the OpenLayers library to create
> the actual maps on the page. After looking at this with Firebug, I guess
> it's a scope issue, as each module's contents is getting put in a function.
> Are there currently ways to correctly load such libraries? And if not, what
> would be a good way of creating this? Making a new class that derives from
> ResourceLoaderModule?
>
> Cheers
>
> --
> Jeroen De Dauw
> * http://blog.bn2vs.com
> * http://wiki.bn2vs.com
> Don't panic. Don't be evil. 50 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69
> 66 65!
> --
> _______________________________________________
> Wikitech-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to