shindig-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derek Houghton <de...@chuwori.co.uk>
Subject Re: javascript question
Date Mon, 25 Jul 2011 18:30:10 GMT
Henry,
I've tried passing the call to the nested javascript function into the gadgets.util.registerOnLoadHandler
and I've also tried placing the javascipt call in a function which is passed to the OnLoadHandler.
Neither works.
Error: 
emouseatlas.emap.RunMe is undefined
emouseatlas.emap.RunMe.stg_run(jso);

I still can't call the nested function.
here is a link to the gadget:
http://www.statetheta.com/rh/stg_test_3.xml
Any thoughts?

Derek



On 21 Jul 2011, at 16:32, Henry Saputra wrote:

> 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 <derek@chuwori.co.uk> 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 <derek@chuwori.co.uk> 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
>>>> 
>>>> 
>> 
>> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message