<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/22 Daniel Narvaez <span dir="ltr"><<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><div class="im">On 22 November 2013 22:59, Rogelio Mita <span dir="ltr"><<a href="mailto:rogeliomita@activitycentral.com" target="_blank">rogeliomita@activitycentral.com</a>></span> wrote:<br></div><div class="gmail_extra">


<div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br>

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>About the logic, unfortunately checking window.sugar won't work because we can't assume window.sugar has been already set when getEnvironment is called... the python code you linked might be called after getEnvironment has been called and will erroneously think we are in standalone mode.<br>





</div></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><div><div><br></div></div></div><div>you are right. I thought for a moment that this fragment is executed to begging before activity.setup(), I'm still in doubt, are you sure about this?</div>


<div><div>


</div></div></div></div></div></blockquote><div><br></div></div><div>The python code is executed when the page (with all it's resources) has been loaded. And I think that can happen either after or before javascript activity.setup(), depending on the page, hardware etc.<br>


</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">

<div class="gmail_quote"><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">


<div>
<br></div><div>That's why I suggested to check if window.location starts with activity://. It's a bit ugly but it will always work.<br></div></div></div></div>
</blockquote></div></div><br>Seems to be a good start, if I understand what you say, it would result there is no need to use callbacks in this method, ie: we can return object environment on sugar environment or null in other case<br>


</div></div></blockquote><div><br></div></div><div>Nope. getEnvironment will still need to be async because in the non-standalone case you need to wait for that python code to be executed. </div></div></div></div></blockquote>

<div><br></div><div>u are right, I missed</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>You could have a env.isStandalone() method (no callback) but I have the feeling that would make the code using env.getEnvironment more complicated.<br>


<br></div><div>Actually I think we should probably have both. Add env.isStandalone() and when that's true make getEnvironment() pass {} to the callback. How does that sound?<br></div></div></div></div></blockquote><div>

<br></div><div>This sounds good, in summary, We should have the logic of window.location in env.isStandalone method and env.getEnvironment still like now but uses IsStandalone like you say above, this will allow eliminating this logic <a href="https://github.com/sugarlabs/sugar-web/blob/master/dictstore.js#L25">here</a> and <a href="https://github.com/sugarlabs/sugar-web/blob/master/dictstore.js#L53">here</a> (ussing isStandalone method), and dictstore become free from the asynchrony, right?</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">

<div><br></div><div>This is all super-icky and difficult to explain, if you don't understand something I can try to clarify further.<br>
</div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Roger<div><br><div><a href="http://activitycentral.com/" target="_blank">Activity Central</a></div></div>
</div></div>