You can include your module in your GSP page as:
<r:require modules="myModule" />
and you can fire any java script function in you js files on page load.
in case your module will not get loaded on the GSP, try adding disposition, i.e.
modules {
myModule {
resources url:'js/application.js', disposition: 'head'
resources url:'js/helper.js', disposition: 'head'
}
}
I think better way to include your resources on the view pages, is through layout, I used to do it like, adding all the resources on the layout page, ex. layout->main.gsp
add all the required resources on this page as:
<r:require
modules="myModule" />
<g:layoutHead />
<r:layoutResources />
then on all the GSP pages in the application you can apply this layout, i.e.
<g:applyLayout name="main"/>
and to call any java script code(on the included js files) on script load, I think you should associate it with the onload event on the gsp page.