<div dir="ltr"><div>a small intrigue was presented to us related to the way of defining the requirejs "activity" module: <a href="https://github.com/sugarlabs/sugar-web-template/blob/master/js/activity.js" target="_blank">https://github.com/sugarlabs/sugar-web-template/blob/master/js/activity.js</a><br>
</div><div><br></div><div>We note that there are some alternatives to define modules proposed by requirejs: <a href="http://requirejs.org/docs/api.html#cjsmodule" target="_blank">Define a Module with Simplified CommonJS Wrapper</a> and <a href="http://requirejs.org/docs/api.html#funcmodule" target="_blank">Define a Module as a Function</a>, and we no found any other apparent reason that this: <i>"If you wish to reuse some code that was written in the traditional CommonJS module format it May be Difficult to re-work to the array of dependencies used above, and you May prefer to Have direct alignment of dependency name to the local Variable used for that dependency "</i>.</div>
<div>Then, there is some particularity reason for you chose to use the "Define a CommonJS Module with Simplified Wrapper" way?, it's just a curiosity that can help us solve the intrigue =).</div><div>Maybe for having a reason for<br>
</div><div><span style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">var</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap"> </span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">activity</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap"> </span><span style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">=</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap"> </span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">require</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">(</span><span style="color:rgb(221,17,68);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">"sugar-web/activity/activity"</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">); ?</span></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/1 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">
Yeah I think it make sense to mention it in the documentation, it's something every developer will run into. I'd suggest to try and keep our own documentation as short as possible and link out to the requirejs shim doc though, to avoid duplication and help maintenance.<div>
<div><br></div></div></blockquote><div>sounds good<br></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><div>
<br>On Saturday, 2 November 2013, Code wrote:<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>Thanks, Daniel!</div><div>I'd rather use "shim", too.</div>
<div><br></div><div>I think it's a common need to have non-AMD dependencies when building an activity.</div><div>What do you think about finding out a canonical way to achieve this and write it down in "write your own activity" doc?</div>
<div><br></div><div>I'm willing to make a pull-request with the updated doc.</div><div><br></div><div>Thanks again,</div><div>Code</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 1, 2013 at 6:18 PM, Daniel Narvaez <span dir="ltr"><<a>dwnarvaez@gmail.com</a>></span> wrote:<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">I think we have been suggesting to use the shim. Modifying loader.js should be fine, the template one shouldn't change often.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On 1 November 2013 22:02, Code <span dir="ltr"><<a>iraguet@activitycentral.com</a>></span> wrote:<br>
</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><div><div dir="ltr">Hello, list!<div>I'd like to add a non-AMD lib (AngularJS in this case) to my activity.</div>
<div><br>
</div><div>Here only points out how to add AMD ones:</div><div><a href="http://developer.sugarlabs.org/activity.md.html#using%20other%20javascript%20libraries" target="_blank">http://developer.sugarlabs.org/activity.md.html#using%20other%20javascript%20libraries</a><br>
</div><div><br></div><div>Of course there are workarounds like adding script tags (I'd rather not) or setting up the "shim" option from RequireJS config...</div><div><a href="https://github.com/code-sur/web-activity-POC/blob/master/js/loader.js" target="_blank">https://github.com/code-sur/web-activity-POC/blob/master/js/loader.js</a><br>
</div><div><br></div><div>But it seems that I shouldn't be touching the loader.js file, isn't it?</div><div><br></div><div>Is there a standard/preferred way to achieve this?<br></div><div><br></div><div><br></div>
<div>Thanks,</div><div>Code</div><div><br></div><div><br></div><div><br></div></div>
<br></div></div>_______________________________________________<br>
Sugar-devel mailing list<br>
<a>Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br>Daniel Narvaez<br>
</font></span></div>
</blockquote></div><br></div>
</blockquote><br><br></div></div><span><font color="#888888">-- <br>Daniel Narvaez<br><br>
</font></span><br>_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
<br></blockquote></div><br><br clear="all"><div>Thanks!</div><div><br></div>-- <br>Roger<div><br><div><a href="http://activitycentral.com/" target="_blank">Activity Central</a></div></div>
</div></div>