lkcl / pyjamas-desktop

Google's Webkit, ported to Python, ported to Desktops.

This URL has Read+Write access

pyjamas-desktop / pyjamas-webkit / pyjamas / BoundMethod.py
100644 16 lines (13 sloc) 0.48 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from pyjamas.__pyjamas__ import JS
 
def BoundMethod(obj, method):
    """
Return a javascript-compatible callable which can be used as a "bound method".
Javascript doesn't support callables, and it doesn't support bound methods,
so you can't use those in pyjamas currently.
This is an OK workaround.
"""
    JS("""
return function() {
return method.apply(obj, arguments);
};
""")