Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create different context #167

Open
GoogleCodeExporter opened this issue May 2, 2015 · 2 comments
Open

Unable to create different context #167

GoogleCodeExporter opened this issue May 2, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

I’m using PyV8 as a base for my Sublime Text plugins. I’ve successfully 
used PyV8 on my Emmet plugin, but now I’m creating a new plugin and have 
issues with JS context.

Each plugin creates it’s own JSContext instance that should keep data and 
exist during plugin lifetime. Context is initiated as follows:

self._ctx = PyV8.JSContext()
self._ctx.enter()
self._ctx.eval('...JS source code...')


The problem is that PyV8 seems to have just one JS context which is shared 
across plugins. 

For example, if Sublime Text loads plugin A and then B, I can access JS methods 
of B plugin but not A (error is: `AttributeError: '[object global]' object has 
no attribute 'XXX'`). If I explicitly reload plugin A (e.g. re-initiate it) I 
can access methods of A but not B.

Here’s how JSContext is used in plugin: 
https://github.com/sergeche/emmet-sublime/blob/master/emmet/context.py#L170

Original issue reported on code.google.com by [email protected] on 22 Mar 2013 at 5:34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant