title: jQuery widget bridge on a non-function based object
body: <p>As part of upgrading from jQuery 1.6.4 to 1.9.x, I'm trying to understand how to use jQuery widget bridge to allow access to functions for widgets created as a standalone object, rather than as an extension to jQuery. </p>
  
  <p>All of the examples (<a href="http://www.erichynds.com/jquery/using-jquery-ui-widget-factory-bridge/" rel="nofollow">like this one</a>) use a prototype function as the source definition of the object, which doesn't seem to map for defining an object directly from a {} based definition.</p>
  
  <p>For example I am defining a widget like this:</p>
  
  <pre><code>var ControlPanel = {
  
      instance: null,
  
      options: {
          //Some options here
      },
  
      simpleFunction: function(){
          alert("I am a function");
      },
  
      _init: function() {
          //Some init stuff here
      }
  }
  
  $.widget("basereality.controlPanel", ControlPanel); // create the widget
  
  //This doesn't appear to work...
  $.widget.bridge('controlPanel', $.basereality.controlPanel); //'Bridge' the widget
  </code></pre>
  
  <p>And then creating an instance of it by doing:</p>
  
  <pre><code>var controlPanelParams = {
    // some options go here
  };
  
  var newControlPanel = $('#controlPanel').controlPanel(controlPanelParams);
  </code></pre>
  
  <p>I would now like to be able to call the method 'simpleFunction' on the created object, which I've tried to do by doing:</p>
  
  <pre><code>newControlPanel.simpleFunction();
  //and 
  $(newControlPanel).simpleFunction();
  </code></pre>
  
  <p>Both of which give a 'Object does not have a method called simpleFunction' error.</p>
  
  <p>So what am I doing wrong and how are you meant to use $.widget.bridge on non-function based objects?</p>