title: GWT JSNI return a js-function
body: <p>How can I return a JavaScript <em>function</em> from JSNI in GWT? I tried it the following way:</p>
  
  <pre><code>/* JSNI method returning a js-function */
  public static native JavaScriptObject native_getFunction() /*-{
      return function(a,b){
          //do some stuff with a,b
      }
  }-*/;
  </code></pre>
  
  <p>Store the function in a variable</p>
  
  <pre><code>/* outside from GWT: store the function in a variable */
  JavaScriptObject myFunction = native_getFunction();
  </code></pre>
  
  <p>Using the function afterwards produces the following error message:</p>
  
  <pre><code>(TypeError): object is not a function
  </code></pre>
  
  <p>Does somebody know how to solve this problem?</p>