jQuery mobile and requirejs

jQuery mobile and requirejs

I'd like to use requirejs with jQM, but can't work out how to get round this problem....

I want to define a module to use like this

require([...,'jquerymobile,...], function(...) {
$(...).on('pagebeforeshow', function () {
<run code from my module>;
});
}).

My code depends on jQM, BUT the above function is called AFTER the first page is is loaded and the 
'pagebeforeshow' event is fired, so that my code never runs.

The problem is that, as requirejs is asynchronous, its not just a question of dependencies between modules, 
but also of timing. My handler needs to be set before the initialization inside jQM which happens 
on $(document).ready().

Does anyone know if I can get around this problem, or are jQM and requirejs incompatible?

Tim