I have some jquery-scripts which I want to put into a plugin. 

In my current setup the code is executed at "mobileinit" with my custom.js file sitting between Jquery.js and Jquery Mobile.js files. 

This is what I'm doing: 

```
(function($ , window, undefined) {
$( window.document ).bind('mobileinit', function(){
          alert ("init");
 });     
})(jQuery,window);

```

I would like to make this into a plugin using the Jquery Widget factory as recommended by [JQM-developers](https://gist.github.com/1071960)

Currently I'm stuck with the following: 

```
(function( $, window, undefined ){
   $.widget( "myPlugin", $.mobile.widget, {
        options: { },
        _create: function() {$.fn.myPlugin = function() {       
          alert ("init");          
           };
   $( window.document ).bind('mobileinit', function(){ {
     myPlugin();
     });
})( jQuery, window );

```

which does not work... if I put the plugin.js before JQM.js "mobile isn't defined". If I put it afterwards, nothing happens. 

My question: 
How can make a widget which runs on mobileinit, that is before Jquery Mobile.js is running.

Thanks for help!