How do I make a function declared in a closure, global ? This is for a google apps script, hence no window.
There is documentation on how to use closures in google apps scripts, but the example declares an object instead of a function.
http://code.google.com/googleapps/appsscript/articles/appengine.html
var JSON = JSON || {};
// foo = function(){}
(function ()
{
...
foo = function (a, b)
{
...
}
foo.prototype =
{
...
}
// window.foo = foo; // Not Possible
}());
This should work:
I’ve made a test in a regular html running on the browser and is works fine. Here is the example:
The firebug output to that is: