<div dir="ltr"><div>I think this is off-topic... </div><div>BTW: perhaps you wanna see this <a href="https://groups.google.com/forum/#!searchin/requirejs/define$20syntax/requirejs/MEBMkF2KdF8/mxvC-pJiy8QJ">thread from RequireJS' list</a> where James Burke (core developer of RequireJS lib) talks about these syntax forms.</div>
<div>If there is something realted to this to add, would u open a new thread, please?</div><div><br></div><div><br></div><div>Getting back to the former topic (loading non-AMD modules):</div><div>There is another approach, require.config() calls are additive, so it is possible to call config from other file than loader.js and require merges it.</div>
<div><br></div><div>example of a require.config() from activity.js:</div><div><a href="https://gist.github.com/code-sur/7305059">https://gist.github.com/code-sur/7305059</a>  ...loader.js stills as it is in sugar-web-template<br>
</div><div><br></div><div>pros:</div><div>* no need to modify loader.js</div><div>* some developers would set other requirejs options</div><div><br></div><div>cons:</div><div>* whole config may spreads among many files</div>
<div><br></div><div>The last "con" may be a "pro" if you want to clearly separete the framework config from the activity specific config</div><div><br></div><div>Code</div><div><br></div><div><br></div>
<div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 3, 2013 at 7:56 PM, Rogelio Mita <span dir="ltr"><<a href="mailto:rogeliomita@activitycentral.com" target="_blank">rogeliomita@activitycentral.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for answer!</div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">2013/11/3 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><br></div><div>As far as I know there is no good reason for that. Probably it was written when we wasn't very familiar with requirejs. I had already fixed one instance of this</div>


<div><br><a href="https://github.com/sugarlabs/sugar-web/commit/8c15d46ac5e6d2fe46db3588322ab2b92907987f" target="_blank">https://github.com/sugarlabs/sugar-web/commit/8c15d46ac5e6d2fe46db3588322ab2b92907987f</a><div><div>


<br>
<br>On Sunday, 3 November 2013, Rogelio Mita  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>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>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>
</blockquote></div></div></div><span><font color="#888888"><br><br>-- <br>Daniel Narvaez<br><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>Roger<div><br><div><a href="http://activitycentral.com/" target="_blank">Activity Central</a></div>
</div>
</font></span></div>
</blockquote></div><br></div>