Initialising fastclick with requirejs

cordova, fastclick.js, requirejs

Solution

Looking through the Fastclick code I found the following functions which works: `Fastclick.attach`

So, instead of calling:

 var attachFastClick = require('fastclick');
        attachFastClick(document.body);

The following works:

 fastclick.attach(document.body);

Problem

I use requirejs with fastclick. I get the following error: ``` Uncaught TypeError: Cannot set property 'trackingClick' of undefined ``` in Fastclick.js line 30 which does: `this.trackingClick = false;` In config.js I run app.js: ``` require.config({ paths: { fastclick:'fastclick' } )}; require(['app'], function (App) { App.initialize(); }); ``` In my `app.js` I do: ``` define(['fastclick'], function(fastclick){ var app = { initialize: function () { var attachFastClick = require('fastclick'); attachFastClick(document.body); } } return app; } ``` The browser starts fine and in the debugger the fastclick library is properly instantiated and resolved but still `this` in the Fastclick.js cannot be resolved. I also tried `fastclick(document.body);` but it did not seem to have any effect. Any ideas?

Original source