In your controller class (.java) you can write this:

                javaScriptSupport.addModuleConfigurationCallback(new 
ModuleConfigurationCallback() {

                        @Override
                        public JSONObject configure(final JSONObject 
configuration) {
                                final JSONObject facebookExports = new 
JSONObject();
                                facebookExports.put("exports", "FB");
                                
configuration.getJSONObject("shim").put("facebook", facebookExports);

                                final JSONObject paths = new JSONObject();
                                paths.put("facebook", 
"//connect.facebook.net/es_ES/sdk");
                                configuration.put("paths", paths);

                                return configuration;
                        }
                });

And in your module file:

define(['facebook'], function(FB){
        
        init = function(appId){
                
          FB.init({
            appId      : appId,
            version    : 'v2.5',
            xfbml      : true
          });
          
        }
        
        return {
                init: init
        }
    
});

For example.

I hope help you.

Regards

Carlos Montero


> El 9/4/2016, a las 14:11, Pavel Chernyak <justan...@gmail.com> escribió:
> 
> Greetings, Ilya.
> Here is my example for Yandex maps module. As you can see I define
> require.js config in module file.
> 
> requirejs.config({ paths: { 'ymaps': '//api-maps.yandex.ru/2.1/?lang=ru-RU',
> 'geolib': 'map/geolib.min' }, "shim": { 'ymaps': { exports: 'ymaps' },
> 'geolib' : { exports: 'geolib' } } }); define(["jquery", "ymaps",
> "geolib","./lodash.min","./graham_scan.min"], function ($, ymaps,geolib) {
> code... });
> 
> Pavel Chernyak.
> 9 апр. 2016 г. 15:05 пользователь "Ilya Obshadko" <xf...@xfyre.com> написал:
> 
>> Facebook recommends the following method to integrate FB SDK using AMD
>> approach:
>> https://developers.facebook.com/docs/javascript/howto/requirejs/v2.5
>> 
>> However I can't find any obvious way to configure RequireJS paths in
>> Tapestry.
>> 
>> Is there any way to do it?
>> 
>> --
>> Ilya Obshadko
>> 

Reply via email to