Hi Cezary,

first thanks. Yes, it was a mixture of all that, meanwhile I studied the requirejs documentation strongly and checked out the tapestry5-jquery project, to learn from it.

And now a lot of things are already working!

A lot in requirejs and AMD semms to be magical and I prefer to do java coding, but we'll never stop to learn...

Regards, Erich



Am 26.03.2018 17:21, schrieb Cezary Biernacki:
Hi Erich,

One problem I can see is that function showLoadingIndicator() is not
exported from define(.., function() { ... }). You should add "return {
showLoadingIndicator: showLoadingIndicator };" at the end of "function() {
... }".

However I believe it will not solve a problem indicated by message
"Couldn’t resolve classpath asset from path
META-INF\modules\hotel\loadingIndicatorTrigger.js" (I guess you are on
Windows, so slashes are translated to slashes, but it should not be an
issue). It suggests that the JS file is missing. So either it was not
copied from the source directories to the directories (or JARs) used during
execution - check your build directories to see if the file is really
there, if not, than run your build process. Or file name
"hotel/loadingIndicatorTrigger"
is misspelled in somewhere.

Cezary





On Sun, Mar 25, 2018 at 3:19 PM, Erich Gormann<e.gorm...@gormann.de>  wrote:

Dear all,

 From a java class I load a js module and try to invoke a method in it
using the following line:

javaScriptSupport.require("hotel/loadingIndicatorTrigger").
invoke("showLoadingIndicator");

The script file loadingIndicatorTrigger.js is in
src/main/resources/META-INF/modules/hotel/loadingIndicatorTrigger.js

This is the content of the script:
requirejs.config({
"shim": {
"hotel/globals/jquery.loading.indicator": {
deps: ["jquery"]
}
}
});

define(["hotel/globals/jquery.loading.indicator"], function() {

function showLoadingIndicator() {
var homeLoader = jQuery('body').loadingIndicator({
useImage: false,
}).data("loadingIndicator");
homeLoader.show();
}

});

Now the browser console prompts always the following error: "RequireJS
error: require: moduleLib is undefined".

In my Eclipse I see a warning in above line of java code: "Couldn’t
resolve classpath asset from path META-INF\modules\hotel\loading
IndicatorTrigger.js"

I tried different things like
define(["jquery", "hotel/globals/jquery.loading.indicator"], function($) {
buterror is always the same.

Is there something missing in my configuration or in the applications
module class?

Thanks for your help!


Regards, Erich





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to