title: Is it possible to have an static variable in a handler?
body: <p>I want to make an script that keeps track of the times a button is pressed. It is well known that javascript lacks of support for static vars but this can normally be workaround defining the variable outside of the target function.</p>
  
  <p>Nevertheless this does not work for me on a simple google scripting web application. The code is the following one and it is a simple extension of the template web aplication.</p>
  
  <p>Anyone knows how can this be achieved?</p>
  
  <p>This is the code of the google application:</p>
  
  <pre><code>// Script-as-app template.
  
  function doGet() {
    var app = UiApp.createApplication();
    var button = app.createButton('Click Me');
    app.add(button);
    var label = app.createLabel('The button was clicked.')
                   .setId('statusLabel')
                   .setVisible(false);
    app.add(label);
    myClickHandler.counter = 0;
  
    var handler = app.createServerHandler('myClickHandler');
    handler.addCallbackElement(label);
    button.addClickHandler(handler);
  
    return app;
  }
  
  function myClickHandler(e) {
    var app = UiApp.getActiveApplication();
  
    var label = app.getElementById('statusLabel');
    label.setVisible(true);
    label.setText('Clicked ' + myClickHandler.counter + ' times.')
    myClickHandler.counter++;
    //app.close();
    return app;
  }
  </code></pre>