So its just a regular JavaScript function which included as external source.
You can add event handler that call that JavaScript function or register a function with gadgets.util.registerOnLoadHandler that will be called once gagdte is loaded and call that nested function. Unless I am missing something obvious. - Henry On Wed, Jul 20, 2011 at 10:50 PM, Derek Houghton <[email protected]> wrote: > HI Henry, > I mean its referenced from within the gadget CDATA section with <script > type="text/javascript" src="www.myRemoteServer/script.js"> > > Derek > > > On 20 Jul 2011, at 22:53, Henry Saputra wrote: > >> HI Derek, >> >> When you said external to gadget, did you mean its loaded from parent >> gadget iframe? >> >> - Henry >> >> On Wed, Jul 20, 2011 at 1:55 PM, Derek Houghton <[email protected]> wrote: >>> >>> Hi, >>> I have a javascript file with nested functions as shown below. It is >>> external to the gadget. >>> >>> How can I call the nested function (stg_run) from within the gadget? >>> >>> from within gadget: >>> emouseatlas.emap.RunMe.stg_run(jso); >>> >>> Thanks >>> Derek >>> >>> //--------------------------------------------------------- >>> // Namespace: >>> //--------------------------------------------------------- >>> if(!emouseatlas) { >>> var emouseatlas = {}; >>> } >>> if(!emouseatlas.emap) { >>> emouseatlas.emap = {}; >>> } >>> >>> >>> //--------------------------------------------------------- >>> // module for testing from a social gadget >>> // encapsulating it in a module to preserve namespace >>> //--------------------------------------------------------- >>> emouseatlas.emap.RunMe = function() { >>> var _debug=true; >>> stg_run = function(url) { >>> >>> //output to firebug >>> if(_debug) { >>> console.log("inner scope stg_run %s",url); >>> } >>> };//end stg_run >>> }();//end RunMe >>> >>> > >
