Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8a54b8987b
Fetching contributors…

Cannot retrieve contributors at this time

file 14 lines (10 sloc) 0.488 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/env python
from PyV8 import *

firstSrc = "function hello(s) { return 'hello ' + s; }"
firstPy = JSExtension("hello/javascript", firstSrc, register=False)
firstPy.register()


secondSrc = "native function title(s);"
secondPy = JSExtension("title/python", secondSrc, lambda secondfunc: lambda name: "Mr. " + name, register=False)
secondPy.register()

with JSContext(extensions=['title/python', 'hello/javascript']) as ctx:
print ctx.eval("hello(title('flier'))")
Something went wrong with that request. Please try again.