I think this is off-topic... BTW: perhaps you wanna see this thread from RequireJS' list<https://groups.google.com/forum/#!searchin/requirejs/define$20syntax/requirejs/MEBMkF2KdF8/mxvC-pJiy8QJ> where James Burke (core developer of RequireJS lib) talks about these syntax forms. If there is something realted to this to add, would u open a new thread, please?
Getting back to the former topic (loading non-AMD modules): 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. example of a require.config() from activity.js: https://gist.github.com/code-sur/7305059 ...loader.js stills as it is in sugar-web-template pros: * no need to modify loader.js * some developers would set other requirejs options cons: * whole config may spreads among many files The last "con" may be a "pro" if you want to clearly separete the framework config from the activity specific config Code On Sun, Nov 3, 2013 at 7:56 PM, Rogelio Mita < rogeliom...@activitycentral.com> wrote: > Thanks for answer! > > > 2013/11/3 Daniel Narvaez <dwnarv...@gmail.com> > >> Hi, >> >> 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 >> >> >> https://github.com/sugarlabs/sugar-web/commit/8c15d46ac5e6d2fe46db3588322ab2b92907987f >> >> >> On Sunday, 3 November 2013, Rogelio Mita wrote: >> >>> a small intrigue was presented to us related to the way of defining the >>> requirejs "activity" module: >>> https://github.com/sugarlabs/sugar-web-template/blob/master/js/activity.js >>> >>> We note that there are some alternatives to define modules proposed by >>> requirejs: Define a Module with Simplified CommonJS >>> Wrapper<http://requirejs.org/docs/api.html#cjsmodule> and >>> Define a Module as a >>> Function<http://requirejs.org/docs/api.html#funcmodule>, and >>> we no found any other apparent reason that this: *"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 "*. >>> 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 =). >>> Maybe for having a reason for >>> var activity = require("sugar-web/activity/activity"); ? >>> >>> >>> 2013/11/1 Daniel Narvaez <dwnarv...@gmail.com> >>> >>>> 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. >>>> >>>> sounds good >>> >>> >>>> >>>> On Saturday, 2 November 2013, Code wrote: >>>> >>>>> Thanks, Daniel! >>>>> I'd rather use "shim", too. >>>>> >>>>> I think it's a common need to have non-AMD dependencies when building >>>>> an activity. >>>>> What do you think about finding out a canonical way to achieve this >>>>> and write it down in "write your own activity" doc? >>>>> >>>>> I'm willing to make a pull-request with the updated doc. >>>>> >>>>> Thanks again, >>>>> Code >>>>> >>>>> >>>>> On Fri, Nov 1, 2013 at 6:18 PM, Daniel Narvaez <dwnarv...@gmail.com>wrote: >>>>> >>>>>> I think we have been suggesting to use the shim. Modifying loader.js >>>>>> should be fine, the template one shouldn't change often. >>>>>> >>>>>> >>>>>> On 1 November 2013 22:02, Code <irag...@activitycentral.com> wrote: >>>>>> >>>>>>> Hello, list! >>>>>>> I'd like to add a non-AMD lib (AngularJS in this case) to my >>>>>>> activity. >>>>>>> >>>>>>> Here only points out how to add AMD ones: >>>>>>> >>>>>>> http://developer.sugarlabs.org/activity.md.html#using%20other%20javascript%20libraries >>>>>>> >>>>>>> Of course there are workarounds like adding script tags (I'd rather >>>>>>> not) or setting up the "shim" option from RequireJS config... >>>>>>> https://github.com/code-sur/web-activity-POC/blob/master/js/loader.js >>>>>>> >>>>>>> But it seems that I shouldn't be touching the loader.js file, isn't >>>>>>> it? >>>>>>> >>>>>>> Is there a standard/preferred way to achieve this? >>>>>>> >>>>>>> >>>>>>> Thanks, >>>>>>> Code >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Sugar-devel mailing list >>>>>>> Sugar-devel@lists.sugarlabs.org >>>>>>> http://lists.sugarlabs.org/listinfo/sugar-devel >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Daniel Narvaez >>>>>> >>>>> >>>>> >>>> >>>> -- >>>> Daniel Narvaez >>>> >>>> >>>> _______________________________________________ >>>> Sugar-devel mailing list >>>> Sugar-devel@lists.sugarlabs.org >>>> http://lists.sugarlabs.org/listinfo/sugar-devel >>>> >>>> >>> >>> Thanks! >>> >>> -- >>> Roger >>> >>> Activity Central <http://activitycentral.com/> >>> >> >> >> -- >> Daniel Narvaez >> >> > > > -- > Roger > > Activity Central <http://activitycentral.com/> >
_______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel