You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Davies,Douglas" <da...@oclc.org> on 2015/04/29 17:39:36 UTC
getActiveSiteHolder
Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder() not being initialized immediately after container.navigateGadget? I use this to add chrome to my gadget. Sometimes this fails because the active site holder isn’t set yet. If I delay for a second (or add an alert) then it’s set. I even tried adding an onRender lifecycle callback, with the same result (I figured if I was getting the callback rendering should be done). It appears that it’s either suppose to return loadingGadgetHolder or currentGadgetHolder.
Ideas?
doug
Re: getActiveSiteHolder
Posted by "Davies,Douglas" <da...@oclc.org>.
I have submitted bug
https://issues.apache.org/jira/browse/SHINDIG-1994
and a proposed fix in review
https://reviews.apache.org/r/33940
The issue has to do with the new module id stuff and the callback in gadget_site:navigateTo being called before the setModuleId_ method competes. I restructured the code to have the broken path not call the callback until the setModuleId completes.
I guess I’ll have to patch this locally for now, since I’ve implemented the module_id stuff in our code. I doubt there will be a shindig 2.5.3 release anytime soon.
doug
Re: getActiveSiteHolder
Posted by "Davies,Douglas" <da...@oclc.org>.
Ok, I figured it out. It has to do with the MODULE_ID renderParam, which is why I didn’t see this issue until I implemented module_id stuff.
If I do the following:
var renderParams = {};
renderParams[osapi.container.RenderParam.MODULE_ID] = 1;
container.navigateGadget(gadgetSite, gadgetXml, {}, renderParams, function(){
// log active site immediately (undefined)
console.log("activeSiteHolder1=" + gadgetSite.getActiveSiteHolder());
// log active site 1 second later (now has a value)
setTimeout(function() {
console.log("activeSiteHolder2=" + gadgetSite.getActiveSiteHolder());
}, 1000);
});
activeSiteHolder is undefined on the first getter (even though I’m in the callback function). If I removed the 2nd line and not set the MODULE_ID render param then it works. I’ll see if I can dig into why.
doug
On May 6, 2015, at 9:36 AM, Davies,Douglas <da...@oclc.org>> wrote:
Stanton,
I could have sworn that’s what my code was doing originally (the callback). But I just tried it in the sample I sent and it’s working. Thanks! I’ll let ya know if I experience any further problems with it.
doug
On May 5, 2015, at 8:35 PM, Stanton Sievers <ss...@apache.org>> wrote:
Hi Doug,
If you want to get a handle to the sites and holders you should be doing so
in the optional callback to navigateGadget. See the method signature [1]
for more information. You can also hook the lifecycle callbacks [2] and
listen for ON_NAVIGATED [3] and you'll be given the site after the gadget
has rendered.
I hope that helps!
-Stanton
[1]
https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container/container.js#L192
[2]
https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container/container.js#L275
[3]
https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container.util/constant.js#L170
On Tue, May 5, 2015 at 9:29 AM, Davies,Douglas <da...@oclc.org> wrote:
Hi Stanton,
Thanks for the feedback.
Here’s a working (or non-working) example of the problem. Just drop this
in your common container directory along-side index.html.
<html><body onload="init();"><div id="1"></div></body></html>
<script type="text/javascript"
src="../../../gadgets/js/container.js?c=1&debug=1&container=default"></script>
<script type="text/javascript">
function init() {
var gadgetXml = '
https://dl.dropboxusercontent.com/u/445894/gadgets/settitle.xml';
var container = new osapi.container.Container({});
var gadgetSite = container.newGadgetSite(
document.getElementById('1') );
container.navigateGadget(gadgetSite, gadgetXml, [], {});
// log active site immediately (undefined)
console.log("activeSiteHolder1=" +
gadgetSite.getActiveSiteHolder());
// log active site 1 second later (now has a value)
setTimeout(function() {
console.log("activeSiteHolder2=" +
gadgetSite.getActiveSiteHolder());
}, 1000);
}
</script>
and the output
"activeSiteHolder1=undefined"
"activeSiteHolder2=[object Object]"
Occasionally even activeSiteHolder2 will still be undefined. A refresh
usually causes it to have a value. activeSiteHolder1 always appears to be
undefined. This occasionally bites us with our chrome not rendering
(chrome not shown here) because it’s dependent on finding the gadget
element.
Should I reopen or create a new jira? I can try to look into why it’s
doing this. Any suggestions are welcome. I tried to wait for the onRender
lifecycle callback, and even that didn’t work.
Also (Ryan included), about my earlier question about updating the wiki
with my module_id discoveries… how is that commonly done. Funneled through
someone?
Thanks,
doug
On May 1, 2015, at 9:28 AM, Stanton Sievers <ssievers@apache.org<mailto:
ssievers@apache.org>> wrote:
This seems vaguely familiar but I can't pinpoint a JIRA ticket for the
exact issue. I did find [1] which I encountered a year ago or so.
What version of Shindig are you using? At what point in the gadget
lifecycle are you trying to get the active holder?
[1] https://issues.apache.org/jira/browse/SHINDIG-1965
On Wed, Apr 29, 2015 at 11:39 AM, Davies,Douglas <daviesd@oclc.org<mailto:
daviesd@oclc.org>> wrote:
Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder()
not being initialized immediately after container.navigateGadget? I use
this to add chrome to my gadget. Sometimes this fails because the active
site holder isn’t set yet. If I delay for a second (or add an alert) then
it’s set. I even tried adding an onRender lifecycle callback, with the
same result (I figured if I was getting the callback rendering should be
done). It appears that it’s either suppose to return loadingGadgetHolder
or currentGadgetHolder.
Ideas?
doug
Re: getActiveSiteHolder
Posted by "Davies,Douglas" <da...@oclc.org>.
Stanton,
I could have sworn that’s what my code was doing originally (the callback). But I just tried it in the sample I sent and it’s working. Thanks! I’ll let ya know if I experience any further problems with it.
doug
On May 5, 2015, at 8:35 PM, Stanton Sievers <ss...@apache.org> wrote:
> Hi Doug,
>
> If you want to get a handle to the sites and holders you should be doing so
> in the optional callback to navigateGadget. See the method signature [1]
> for more information. You can also hook the lifecycle callbacks [2] and
> listen for ON_NAVIGATED [3] and you'll be given the site after the gadget
> has rendered.
>
> I hope that helps!
>
> -Stanton
>
> [1]
> https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container/container.js#L192
> [2]
> https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container/container.js#L275
> [3]
> https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container.util/constant.js#L170
>
> On Tue, May 5, 2015 at 9:29 AM, Davies,Douglas <da...@oclc.org> wrote:
>
>> Hi Stanton,
>>
>> Thanks for the feedback.
>>
>> Here’s a working (or non-working) example of the problem. Just drop this
>> in your common container directory along-side index.html.
>>
>> <html><body onload="init();"><div id="1"></div></body></html>
>>
>> <script type="text/javascript"
>> src="../../../gadgets/js/container.js?c=1&debug=1&container=default"></script>
>> <script type="text/javascript">
>> function init() {
>> var gadgetXml = '
>> https://dl.dropboxusercontent.com/u/445894/gadgets/settitle.xml';
>> var container = new osapi.container.Container({});
>> var gadgetSite = container.newGadgetSite(
>> document.getElementById('1') );
>> container.navigateGadget(gadgetSite, gadgetXml, [], {});
>> // log active site immediately (undefined)
>> console.log("activeSiteHolder1=" +
>> gadgetSite.getActiveSiteHolder());
>> // log active site 1 second later (now has a value)
>> setTimeout(function() {
>> console.log("activeSiteHolder2=" +
>> gadgetSite.getActiveSiteHolder());
>> }, 1000);
>> }
>> </script>
>>
>> and the output
>>
>> "activeSiteHolder1=undefined"
>> "activeSiteHolder2=[object Object]"
>>
>> Occasionally even activeSiteHolder2 will still be undefined. A refresh
>> usually causes it to have a value. activeSiteHolder1 always appears to be
>> undefined. This occasionally bites us with our chrome not rendering
>> (chrome not shown here) because it’s dependent on finding the gadget
>> element.
>>
>> Should I reopen or create a new jira? I can try to look into why it’s
>> doing this. Any suggestions are welcome. I tried to wait for the onRender
>> lifecycle callback, and even that didn’t work.
>>
>> Also (Ryan included), about my earlier question about updating the wiki
>> with my module_id discoveries… how is that commonly done. Funneled through
>> someone?
>>
>> Thanks,
>> doug
>>
>> On May 1, 2015, at 9:28 AM, Stanton Sievers <ssievers@apache.org<mailto:
>> ssievers@apache.org>> wrote:
>>
>> This seems vaguely familiar but I can't pinpoint a JIRA ticket for the
>> exact issue. I did find [1] which I encountered a year ago or so.
>>
>> What version of Shindig are you using? At what point in the gadget
>> lifecycle are you trying to get the active holder?
>>
>> [1] https://issues.apache.org/jira/browse/SHINDIG-1965
>>
>> On Wed, Apr 29, 2015 at 11:39 AM, Davies,Douglas <daviesd@oclc.org<mailto:
>> daviesd@oclc.org>> wrote:
>>
>> Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder()
>> not being initialized immediately after container.navigateGadget? I use
>> this to add chrome to my gadget. Sometimes this fails because the active
>> site holder isn’t set yet. If I delay for a second (or add an alert) then
>> it’s set. I even tried adding an onRender lifecycle callback, with the
>> same result (I figured if I was getting the callback rendering should be
>> done). It appears that it’s either suppose to return loadingGadgetHolder
>> or currentGadgetHolder.
>>
>> Ideas?
>>
>> doug
>>
>>
>>
>>
>>
Re: getActiveSiteHolder
Posted by Stanton Sievers <ss...@apache.org>.
Hi Doug,
If you want to get a handle to the sites and holders you should be doing so
in the optional callback to navigateGadget. See the method signature [1]
for more information. You can also hook the lifecycle callbacks [2] and
listen for ON_NAVIGATED [3] and you'll be given the site after the gadget
has rendered.
I hope that helps!
-Stanton
[1]
https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container/container.js#L192
[2]
https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container/container.js#L275
[3]
https://github.com/apache/shindig/blob/trunk/features/src/main/javascript/features/container.util/constant.js#L170
On Tue, May 5, 2015 at 9:29 AM, Davies,Douglas <da...@oclc.org> wrote:
> Hi Stanton,
>
> Thanks for the feedback.
>
> Here’s a working (or non-working) example of the problem. Just drop this
> in your common container directory along-side index.html.
>
> <html><body onload="init();"><div id="1"></div></body></html>
>
> <script type="text/javascript"
> src="../../../gadgets/js/container.js?c=1&debug=1&container=default"></script>
> <script type="text/javascript">
> function init() {
> var gadgetXml = '
> https://dl.dropboxusercontent.com/u/445894/gadgets/settitle.xml';
> var container = new osapi.container.Container({});
> var gadgetSite = container.newGadgetSite(
> document.getElementById('1') );
> container.navigateGadget(gadgetSite, gadgetXml, [], {});
> // log active site immediately (undefined)
> console.log("activeSiteHolder1=" +
> gadgetSite.getActiveSiteHolder());
> // log active site 1 second later (now has a value)
> setTimeout(function() {
> console.log("activeSiteHolder2=" +
> gadgetSite.getActiveSiteHolder());
> }, 1000);
> }
> </script>
>
> and the output
>
> "activeSiteHolder1=undefined"
> "activeSiteHolder2=[object Object]"
>
> Occasionally even activeSiteHolder2 will still be undefined. A refresh
> usually causes it to have a value. activeSiteHolder1 always appears to be
> undefined. This occasionally bites us with our chrome not rendering
> (chrome not shown here) because it’s dependent on finding the gadget
> element.
>
> Should I reopen or create a new jira? I can try to look into why it’s
> doing this. Any suggestions are welcome. I tried to wait for the onRender
> lifecycle callback, and even that didn’t work.
>
> Also (Ryan included), about my earlier question about updating the wiki
> with my module_id discoveries… how is that commonly done. Funneled through
> someone?
>
> Thanks,
> doug
>
> On May 1, 2015, at 9:28 AM, Stanton Sievers <ssievers@apache.org<mailto:
> ssievers@apache.org>> wrote:
>
> This seems vaguely familiar but I can't pinpoint a JIRA ticket for the
> exact issue. I did find [1] which I encountered a year ago or so.
>
> What version of Shindig are you using? At what point in the gadget
> lifecycle are you trying to get the active holder?
>
> [1] https://issues.apache.org/jira/browse/SHINDIG-1965
>
> On Wed, Apr 29, 2015 at 11:39 AM, Davies,Douglas <daviesd@oclc.org<mailto:
> daviesd@oclc.org>> wrote:
>
> Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder()
> not being initialized immediately after container.navigateGadget? I use
> this to add chrome to my gadget. Sometimes this fails because the active
> site holder isn’t set yet. If I delay for a second (or add an alert) then
> it’s set. I even tried adding an onRender lifecycle callback, with the
> same result (I figured if I was getting the callback rendering should be
> done). It appears that it’s either suppose to return loadingGadgetHolder
> or currentGadgetHolder.
>
> Ideas?
>
> doug
>
>
>
>
>
Re: getActiveSiteHolder
Posted by Ryan Baxter <rb...@apache.org>.
I can add you so you have editor rights, do you already have an account?
On Tue, May 5, 2015 at 2:58 PM, Davies,Douglas <da...@oclc.org> wrote:
> Where ever adding some documentation about module_id would be useful.
>
> https://cwiki.apache.org/confluence/display/SHINDIG/Common+Container ?
>
> I see discussions about Dan Dumont writing up some documentation for his
> changes, but I don’t see where that was ever done.
>
> Thanks,
> doug
>
> On May 5, 2015, at 9:41 AM, Ryan Baxter <rbaxter85@apache.org<mailto:
> rbaxter85@apache.org>> wrote:
>
> On Tue, May 5, 2015 at 2:29 PM, Davies,Douglas <daviesd@oclc.org<mailto:
> daviesd@oclc.org>> wrote:
>
> Hi Stanton,
>
> Thanks for the feedback.
>
> Here’s a working (or non-working) example of the problem. Just drop this
> in your common container directory along-side index.html.
>
> <html><body onload="init();"><div id="1"></div></body></html>
>
> <script type="text/javascript"
>
> src="../../../gadgets/js/container.js?c=1&debug=1&container=default"></script>
> <script type="text/javascript">
> function init() {
> var gadgetXml = '
> https://dl.dropboxusercontent.com/u/445894/gadgets/settitle.xml';
> var container = new osapi.container.Container({});
> var gadgetSite = container.newGadgetSite(
> document.getElementById('1') );
> container.navigateGadget(gadgetSite, gadgetXml, [], {});
> // log active site immediately (undefined)
> console.log("activeSiteHolder1=" +
> gadgetSite.getActiveSiteHolder());
> // log active site 1 second later (now has a value)
> setTimeout(function() {
> console.log("activeSiteHolder2=" +
> gadgetSite.getActiveSiteHolder());
> }, 1000);
> }
> </script>
>
> and the output
>
> "activeSiteHolder1=undefined"
> "activeSiteHolder2=[object Object]"
>
> Occasionally even activeSiteHolder2 will still be undefined. A refresh
> usually causes it to have a value. activeSiteHolder1 always appears to be
> undefined. This occasionally bites us with our chrome not rendering
> (chrome not shown here) because it’s dependent on finding the gadget
> element.
>
> Should I reopen or create a new jira? I can try to look into why it’s
> doing this. Any suggestions are welcome. I tried to wait for the onRender
> lifecycle callback, and even that didn’t work.
>
> Also (Ryan included), about my earlier question about updating the wiki
> with my module_id discoveries… how is that commonly done. Funneled through
> someone?
>
> Which page do you want to update?
>
>
> Thanks,
> doug
>
> On May 1, 2015, at 9:28 AM, Stanton Sievers <ssievers@apache.org<mailto:
> ssievers@apache.org><mailto:
> ssievers@apache.org<ma...@apache.org>>> wrote:
>
> This seems vaguely familiar but I can't pinpoint a JIRA ticket for the
> exact issue. I did find [1] which I encountered a year ago or so.
>
> What version of Shindig are you using? At what point in the gadget
> lifecycle are you trying to get the active holder?
>
> [1] https://issues.apache.org/jira/browse/SHINDIG-1965
>
> On Wed, Apr 29, 2015 at 11:39 AM, Davies,Douglas <daviesd@oclc.org<mailto:
> daviesd@oclc.org><mailto:
> daviesd@oclc.org<ma...@oclc.org>>> wrote:
>
> Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder()
> not being initialized immediately after container.navigateGadget? I use
> this to add chrome to my gadget. Sometimes this fails because the active
> site holder isn’t set yet. If I delay for a second (or add an alert) then
> it’s set. I even tried adding an onRender lifecycle callback, with the
> same result (I figured if I was getting the callback rendering should be
> done). It appears that it’s either suppose to return loadingGadgetHolder
> or currentGadgetHolder.
>
> Ideas?
>
> doug
>
>
Re: getActiveSiteHolder
Posted by "Davies,Douglas" <da...@oclc.org>.
Where ever adding some documentation about module_id would be useful.
https://cwiki.apache.org/confluence/display/SHINDIG/Common+Container ?
I see discussions about Dan Dumont writing up some documentation for his changes, but I don’t see where that was ever done.
Thanks,
doug
On May 5, 2015, at 9:41 AM, Ryan Baxter <rb...@apache.org>> wrote:
On Tue, May 5, 2015 at 2:29 PM, Davies,Douglas <da...@oclc.org>> wrote:
Hi Stanton,
Thanks for the feedback.
Here’s a working (or non-working) example of the problem. Just drop this
in your common container directory along-side index.html.
<html><body onload="init();"><div id="1"></div></body></html>
<script type="text/javascript"
src="../../../gadgets/js/container.js?c=1&debug=1&container=default"></script>
<script type="text/javascript">
function init() {
var gadgetXml = '
https://dl.dropboxusercontent.com/u/445894/gadgets/settitle.xml';
var container = new osapi.container.Container({});
var gadgetSite = container.newGadgetSite(
document.getElementById('1') );
container.navigateGadget(gadgetSite, gadgetXml, [], {});
// log active site immediately (undefined)
console.log("activeSiteHolder1=" +
gadgetSite.getActiveSiteHolder());
// log active site 1 second later (now has a value)
setTimeout(function() {
console.log("activeSiteHolder2=" +
gadgetSite.getActiveSiteHolder());
}, 1000);
}
</script>
and the output
"activeSiteHolder1=undefined"
"activeSiteHolder2=[object Object]"
Occasionally even activeSiteHolder2 will still be undefined. A refresh
usually causes it to have a value. activeSiteHolder1 always appears to be
undefined. This occasionally bites us with our chrome not rendering
(chrome not shown here) because it’s dependent on finding the gadget
element.
Should I reopen or create a new jira? I can try to look into why it’s
doing this. Any suggestions are welcome. I tried to wait for the onRender
lifecycle callback, and even that didn’t work.
Also (Ryan included), about my earlier question about updating the wiki
with my module_id discoveries… how is that commonly done. Funneled through
someone?
Which page do you want to update?
Thanks,
doug
On May 1, 2015, at 9:28 AM, Stanton Sievers <ss...@apache.org><mailto:
ssievers@apache.org<ma...@apache.org>>> wrote:
This seems vaguely familiar but I can't pinpoint a JIRA ticket for the
exact issue. I did find [1] which I encountered a year ago or so.
What version of Shindig are you using? At what point in the gadget
lifecycle are you trying to get the active holder?
[1] https://issues.apache.org/jira/browse/SHINDIG-1965
On Wed, Apr 29, 2015 at 11:39 AM, Davies,Douglas <da...@oclc.org><mailto:
daviesd@oclc.org<ma...@oclc.org>>> wrote:
Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder()
not being initialized immediately after container.navigateGadget? I use
this to add chrome to my gadget. Sometimes this fails because the active
site holder isn’t set yet. If I delay for a second (or add an alert) then
it’s set. I even tried adding an onRender lifecycle callback, with the
same result (I figured if I was getting the callback rendering should be
done). It appears that it’s either suppose to return loadingGadgetHolder
or currentGadgetHolder.
Ideas?
doug
Re: getActiveSiteHolder
Posted by Ryan Baxter <rb...@apache.org>.
On Tue, May 5, 2015 at 2:29 PM, Davies,Douglas <da...@oclc.org> wrote:
> Hi Stanton,
>
> Thanks for the feedback.
>
> Here’s a working (or non-working) example of the problem. Just drop this
> in your common container directory along-side index.html.
>
> <html><body onload="init();"><div id="1"></div></body></html>
>
> <script type="text/javascript"
> src="../../../gadgets/js/container.js?c=1&debug=1&container=default"></script>
> <script type="text/javascript">
> function init() {
> var gadgetXml = '
> https://dl.dropboxusercontent.com/u/445894/gadgets/settitle.xml';
> var container = new osapi.container.Container({});
> var gadgetSite = container.newGadgetSite(
> document.getElementById('1') );
> container.navigateGadget(gadgetSite, gadgetXml, [], {});
> // log active site immediately (undefined)
> console.log("activeSiteHolder1=" +
> gadgetSite.getActiveSiteHolder());
> // log active site 1 second later (now has a value)
> setTimeout(function() {
> console.log("activeSiteHolder2=" +
> gadgetSite.getActiveSiteHolder());
> }, 1000);
> }
> </script>
>
> and the output
>
> "activeSiteHolder1=undefined"
> "activeSiteHolder2=[object Object]"
>
> Occasionally even activeSiteHolder2 will still be undefined. A refresh
> usually causes it to have a value. activeSiteHolder1 always appears to be
> undefined. This occasionally bites us with our chrome not rendering
> (chrome not shown here) because it’s dependent on finding the gadget
> element.
>
> Should I reopen or create a new jira? I can try to look into why it’s
> doing this. Any suggestions are welcome. I tried to wait for the onRender
> lifecycle callback, and even that didn’t work.
>
> Also (Ryan included), about my earlier question about updating the wiki
> with my module_id discoveries… how is that commonly done. Funneled through
> someone?
>
Which page do you want to update?
>
> Thanks,
> doug
>
> On May 1, 2015, at 9:28 AM, Stanton Sievers <ssievers@apache.org<mailto:
> ssievers@apache.org>> wrote:
>
> This seems vaguely familiar but I can't pinpoint a JIRA ticket for the
> exact issue. I did find [1] which I encountered a year ago or so.
>
> What version of Shindig are you using? At what point in the gadget
> lifecycle are you trying to get the active holder?
>
> [1] https://issues.apache.org/jira/browse/SHINDIG-1965
>
> On Wed, Apr 29, 2015 at 11:39 AM, Davies,Douglas <daviesd@oclc.org<mailto:
> daviesd@oclc.org>> wrote:
>
> Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder()
> not being initialized immediately after container.navigateGadget? I use
> this to add chrome to my gadget. Sometimes this fails because the active
> site holder isn’t set yet. If I delay for a second (or add an alert) then
> it’s set. I even tried adding an onRender lifecycle callback, with the
> same result (I figured if I was getting the callback rendering should be
> done). It appears that it’s either suppose to return loadingGadgetHolder
> or currentGadgetHolder.
>
> Ideas?
>
> doug
>
>
>
>
>
Re: getActiveSiteHolder
Posted by "Davies,Douglas" <da...@oclc.org>.
Hi Stanton,
Thanks for the feedback.
Here’s a working (or non-working) example of the problem. Just drop this in your common container directory along-side index.html.
<html><body onload="init();"><div id="1"></div></body></html>
<script type="text/javascript" src="../../../gadgets/js/container.js?c=1&debug=1&container=default"></script>
<script type="text/javascript">
function init() {
var gadgetXml = 'https://dl.dropboxusercontent.com/u/445894/gadgets/settitle.xml';
var container = new osapi.container.Container({});
var gadgetSite = container.newGadgetSite( document.getElementById('1') );
container.navigateGadget(gadgetSite, gadgetXml, [], {});
// log active site immediately (undefined)
console.log("activeSiteHolder1=" + gadgetSite.getActiveSiteHolder());
// log active site 1 second later (now has a value)
setTimeout(function() {
console.log("activeSiteHolder2=" + gadgetSite.getActiveSiteHolder());
}, 1000);
}
</script>
and the output
"activeSiteHolder1=undefined"
"activeSiteHolder2=[object Object]"
Occasionally even activeSiteHolder2 will still be undefined. A refresh usually causes it to have a value. activeSiteHolder1 always appears to be undefined. This occasionally bites us with our chrome not rendering (chrome not shown here) because it’s dependent on finding the gadget element.
Should I reopen or create a new jira? I can try to look into why it’s doing this. Any suggestions are welcome. I tried to wait for the onRender lifecycle callback, and even that didn’t work.
Also (Ryan included), about my earlier question about updating the wiki with my module_id discoveries… how is that commonly done. Funneled through someone?
Thanks,
doug
On May 1, 2015, at 9:28 AM, Stanton Sievers <ss...@apache.org>> wrote:
This seems vaguely familiar but I can't pinpoint a JIRA ticket for the
exact issue. I did find [1] which I encountered a year ago or so.
What version of Shindig are you using? At what point in the gadget
lifecycle are you trying to get the active holder?
[1] https://issues.apache.org/jira/browse/SHINDIG-1965
On Wed, Apr 29, 2015 at 11:39 AM, Davies,Douglas <da...@oclc.org>> wrote:
Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder()
not being initialized immediately after container.navigateGadget? I use
this to add chrome to my gadget. Sometimes this fails because the active
site holder isn’t set yet. If I delay for a second (or add an alert) then
it’s set. I even tried adding an onRender lifecycle callback, with the
same result (I figured if I was getting the callback rendering should be
done). It appears that it’s either suppose to return loadingGadgetHolder
or currentGadgetHolder.
Ideas?
doug
Re: getActiveSiteHolder
Posted by Stanton Sievers <ss...@apache.org>.
This seems vaguely familiar but I can't pinpoint a JIRA ticket for the
exact issue. I did find [1] which I encountered a year ago or so.
What version of Shindig are you using? At what point in the gadget
lifecycle are you trying to get the active holder?
[1] https://issues.apache.org/jira/browse/SHINDIG-1965
On Wed, Apr 29, 2015 at 11:39 AM, Davies,Douglas <da...@oclc.org> wrote:
> Has anyone had any inconsistencies with gadgetSite.getActiveSiteHolder()
> not being initialized immediately after container.navigateGadget? I use
> this to add chrome to my gadget. Sometimes this fails because the active
> site holder isn’t set yet. If I delay for a second (or add an alert) then
> it’s set. I even tried adding an onRender lifecycle callback, with the
> same result (I figured if I was getting the callback rendering should be
> done). It appears that it’s either suppose to return loadingGadgetHolder
> or currentGadgetHolder.
>
> Ideas?
>
> doug
>
>
>