Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-19 Thread abangkis
Hi Diego and Geoff thanks a lot for the examples. Will work on it again next week. On Wed, Feb 18, 2015 at 11:01 PM, Diego Socaceti wrote: > Hi Geoff, > > here the missing parts :) > > The JavaScriptLibraryModule now have configured four new modules based on > non-AMD JavaScript: > ["modernizr",

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-18 Thread Diego Socaceti
Hi Geoff, here the missing parts :) The JavaScriptLibraryModule now have configured four new modules based on non-AMD JavaScript: ["modernizr", "class", "font-picker", "date-format"]. - "modernizr" js stores itself in a browser global called "Modernizr" ==> .exports("Modernizr") - "class" js

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-18 Thread Diego Socaceti
Hi Geoff, yes, here is some productive code: public class JavaScriptLibraryModule { private static final String MODERNIZR_PATH = "context:third-party/modernizr-2.7.1.js"; private static final String JS_SIMPLE_CLASS_PATH = "context:third-party/class.js"; private static final String JS_FONT_

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-18 Thread Geoff Callender
Hi Diego, That sounds good, but can you give a concrete example of some code, like I gave below. That would be great. Geoff On 19 Feb 2015, at 1:00 am, Diego Socaceti wrote: > sorry, copy, paste-error > > ... use JavaScriptModuleConfiguration#exports() for 'exports' of shim config > > 2015

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-18 Thread Diego Socaceti
sorry, copy, paste-error ... use JavaScriptModuleConfiguration#exports() for 'exports' of shim config 2015-02-18 14:58 GMT+01:00 Diego Socaceti : > Hi @all, > > if you want to shim non-AMD JavaScript files you should use > JavaScriptModuleConfiguration. > It offers everything you need to create

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-18 Thread Diego Socaceti
Hi @all, if you want to shim non-AMD JavaScript files you should use JavaScriptModuleConfiguration. It offers everything you need to create shim configs. use JavaScriptModuleConfiguration#dependsOn() for 'deps' of shim config use JavaScriptModuleConfiguration#dependsOn() for 'exports' of shim con

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-18 Thread Geoff Callender
Despite what I said 9 months ago in the thread you referenced, I'm not sure that I've ever seen the shimming [1] ever work, but I haven't pursued it because the many javascript libraries I use work fine anyway without being modules. [1] http://tapestry.apache.org/5.4/apidocs/org/apache/tapestr

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-17 Thread abangkis
Hi Geoff. You are right. I can call the showMe() method as a global function. So, is it okay if I assume that i could only call the shimmed js lib through global function? Since it wouldn't get passed through the define parameter. Or is my implementation that's incorrect? Is there a better way (b

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-17 Thread abangkis
Hi thiago. I actually have read about requirejs shimming http://requirejs.org/docs/api.html#config-shim to use non-AMD module in requirejs. For requirejs, it's quite forward. We just need to add the shim to requirejs.config (usually in main.js). Looking at this thread https://mail-archives.apache.

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-17 Thread Geoff Callender
Your "require" has ensured the mytest.js file gets loaded by the browser but the file's contents do not define an AMD module. Therefore the scope of showMe() is global, so I think you'll find you can call showMe() but not mytest.showMe(). Geoff On 18 Feb 2015, at 5:05 am, Thiago H de Paula Fig

Re: Trying to load non AMD javascript in tapestry 5.4

2015-02-17 Thread Thiago H de Paula Figueiredo
Please read the Require.js documentation about this. You just cannot use Require.js with non AMD .js files and expect it to work without no further work. On Sat, 14 Feb 2015 14:04:36 -0200, abangkis wrote: Hello. I'm trying to load a simple regular javascript that's going to be used as dep