/addons/BoundMethod.py
Python | 16 lines | 14 code | 1 blank | 1 comment | 0 complexity | 78e97acda8583a54ee5b6f31991b2812 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
- from __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);
- };
- """)