title: Cordova Custom Plugin Structure w/o Callbacks?
body: <p>I'm creating my first Cordova plugin to work with an open source SDK. I'm having issues getting it running without callbacks, because the library doesn't have any (think something like analytics). There's also a bunch of different formats, and the wiki is 2 years old so I'm not sure as to what's the proper way to do things.</p>
  
  <p>I've tried a few different variants of setting up the plugin, but none work successfully.</p>
  
  <p>My .js:</p>
  
  <pre><code>;(function(){
  
      if (Cordova.hasResource("myPlugin")) return
  
      Cordova.addResource("myPlugin")
  
      function MyPlugin() {
      }
  
      MyPlugin.prototype.setup = function(types) {
          return Cordova.exec("MyPlugin.setup", types);
      };
  
      Cordova.addConstructor(function() {
          if(!window.plugins)
          {
              window.plugins = {};
          }
  
         if (!window.plugins.myPlugin) {
             window.plugins.myPlugin = new MyPlugin()
         }
     })
  
  })();
  </code></pre>
  
  <p>The setup function takes 4 arguments, all strings. I include MyPlugin.js in the index.html file, then in onDeviceReady() I call:</p>
  
  <pre><code>window.plugins.myPlugin.setup('xxx-x-xxx','xxxx','xxxx','xxxx');
  </code></pre>
  
  <p>Whenever I try to run I get the error <code>[INFO] Error in success callback: NetworkStatus0 = TypeError: 'undefined' is not an object</code>.</p>
  
  <p>I have tried googling and whatnot, and found several different PhoneGap plugin formats, and I've tried them all, and none work. I'm using Cordova 1.6.1 if that helps.</p>
  
  <p>Here's a list of different structures I've tried mimicking:</p>
  
  <ul>
  <li><a href="https://github.com/chbrody/Cordova-ios-UniqueDeviceId/blob/master/UniqueDeviceId.js" rel="nofollow">https://github.com/chbrody/Cordova-ios-UniqueDeviceId/blob/master/UniqueDeviceId.js</a></li>
  <li><a href="https://github.com/purplecabbage/phonegap-plugins/blob/master/iPhone/BarcodeScanner/barcodescanner.js" rel="nofollow">https://github.com/purplecabbage/phonegap-plugins/blob/master/iPhone/BarcodeScanner/barcodescanner.js</a></li>
  <li><a href="https://github.com/phonegap/phonegap-plugins/blob/master/iOS/BarcodeScanner/barcodescanner.js" rel="nofollow">https://github.com/phonegap/phonegap-plugins/blob/master/iOS/BarcodeScanner/barcodescanner.js</a> </li>
  <li><a href="https://github.com/purplecabbage/phonegap-plugins/blob/master/iPhone/ChildBrowser/ChildBrowser.js" rel="nofollow">https://github.com/purplecabbage/phonegap-plugins/blob/master/iPhone/ChildBrowser/ChildBrowser.js</a></li>
  </ul>
  
  <p>All of them produce the same error, so I'm not sure what the problem is.</p>
  
  <p><strong>EDIT:</strong> I should also mention, my Obj-C code does not get called. There's something up with the JS calls unrelated to the actual functionality of the plugin...</p>