PageRenderTime 24ms CodeModel.GetById 19ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Apache-2.0
  1. from __pyjamas__ import JS
  2. def BoundMethod(obj, method):
  3. """
  4. Return a javascript-compatible callable which can be used as a "bound method".
  5. Javascript doesn't support callables, and it doesn't support bound methods,
  6. so you can't use those in pyjamas currently.
  7. This is an OK workaround.
  8. """
  9. JS("""
  10. return function() {
  11. return method.apply(obj, arguments);
  12. };
  13. """)