PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/addons/BoundMethod.py

http://pyjamas.googlecode.com/
Python | 16 lines | 14 code | 1 blank | 1 comment | 0 complexity | 78e97acda8583a54ee5b6f31991b2812 MD5 | raw file
 1from __pyjamas__ import JS
 2
 3def BoundMethod(obj, method):
 4    """
 5        Return a javascript-compatible callable which can be used as a "bound method".
 6        
 7        Javascript doesn't support callables, and it doesn't support bound methods,
 8        so you can't use those in pyjamas currently.
 9        
10        This is an OK workaround.
11    """
12    JS("""
13        return function() {
14            return method.apply(obj, arguments);
15        };
16    """)