title: Android WebView JavascriptInterface Property
body: <p>Hey I am working with an app that has to interface with some javascript (coffeescript) code. The code JS code looks something like this:</p>
  
  <pre><code>$(".content").on "click", ".feedback", -&gt;
        window.webkit.foo.bar.message("hello")
        false
  </code></pre>
  
  <p>So I need to add a javascript interface to my WebView like:</p>
  
  <pre><code> webView.addJavascriptInterface(new Window(), "window");
   ...
   class Window {
     @JavascriptInterface
     public Webkit webkit() {
       return new Webkit();
     }
     class Webkit {
       @JavascriptInterface
       public Foo foo() {
   ...
  </code></pre>
  
  <p>I am running into two problems here, first it appears you can't add properties to the global window object. And second when I change my interface name to something else, I can't seem to figure out how to add properties rather than methods. </p>
  
  <p>I can get it to work in a way like this:</p>
  
  <pre><code>  webkit().foo().bar().message("hello")
  </code></pre>
  
  <p>Has anyone done anything like this?</p>
  
  <p>Thanks!</p>