title: Sharing state between multiple functions on the prototype
body: <p>I am creating a client side remote object in Eclipse RAP using Javascript for a text widget. I am then adding functions to the object's prototype in order to be handle various events and to do other business logic. Now some of these functions need access to the text widget. </p>
  
  <p>Assuming that <code>init()</code> is always the first function invoked. I am wondering if it would be a good idea to store the text widget on the <code>TextObject</code>'s prototype? Are there any better ways to achieve this?    </p>
  
  <p>Edit: Another thought I had was to pass the text widget to every function which needs it but I don't like that either.  </p>
  
  <pre><code>function TextObject() { }
  
  TextObject.prototype = {
  
     widget:null,
  
     init: function(text)
     {
        this.widget = text;
     },
  
      incrementNumber:function() 
      {
         if(this.widget!=null)
         let textString = this.widget.getText();
      }
  };
  </code></pre>