Injecting a Python function into JavaScript context is actually very simple - you assign that function to a local variable via JSContext.locals object:
ctx = PyV8.JSContext()
ctx.enter()
ctx.locals.prompt = raw_input
ctx.eval('var a = prompt("foo>"js> ")';')
And all the sudden you can use that Python function from JavaScript exactly like you would do it in Python.
I would normally link to the documentation but PyV8 documentation doesn't appear to be available anywhere with the proper MIME type.
Injecting a Python function into JavaScript context is actually very simple - you assign that function to a local variable via JSContext.locals object:
ctx = PyV8.JSContext()
ctx.enter()
ctx.locals.prompt = raw_input
ctx.eval('var a = prompt("foo> ")')
And all the sudden you can use that Python function from JavaScript exactly like you would do it in Python.
Injecting a Python function into JavaScript context is actually very simple - you assign that function to a local variable via JSContext.locals object:
ctx = PyV8.JSContext()
ctx.enter()
ctx.locals.prompt = raw_input
ctx.eval('var a = prompt("js> ");')
And all the sudden you can use that Python function from JavaScript exactly like you would do it in Python.
I would normally link to the documentation but PyV8 documentation doesn't appear to be available anywhere with the proper MIME type.
Injecting a Python function into JavaScript context is actually very simple - you assign that function to a local variable via JSContext.locals object:
ctx = PyV8.JSContext()
ctx.enter()
ctx.locals.prompt = raw_input
ctx.eval('var a = prompt("foo> ")')
And all the sudden you can use that Python function from JavaScript exactly like you would do it in Python.