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

Using viz.js distribution in WebWorker together with require.js #41

Closed
mstefaniuk opened this issue Feb 1, 2015 · 3 comments
Closed

Comments

@mstefaniuk
Copy link

I'm developing an online Graphviz dot editor and I'm using old version of viz.js. I made a common module adding define wrapper around distribution code and I embedded it in WebWorker with use of require() as described in its guideline.

Now I'm trying to upgrade to newer version but I have problems to use it in the same way. I'm receiving errors from initializing my module depending on viz.js. As far I understand (from generated code) there is support for WebWorker environment and require.js also. I'm not sure if it is supporting both together. If yes please give me an advice how to do that.

@mdaines
Copy link
Owner

mdaines commented Sep 4, 2015

The wrapper code for Viz.js used to reference the window object, so it couldn't directly be used in a Web Worker. I've changed this in the most recent version. Have a look at the gh-pages branch for an example: https://github.com/mdaines/viz.js/tree/gh-pages

@mdaines mdaines closed this as completed Sep 4, 2015
@mstefaniuk
Copy link
Author

@mdaines In your example viz.js is included into WebWorker with importScripts(). My question was how to do it the same with use of require.js.

@mdaines
Copy link
Owner

mdaines commented Sep 30, 2015

In that case, I don't know. I assume you'll have to either add the define wrapper yourself or use a shim: http://requirejs.org/docs/api.html#config-shim

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

No branches or pull requests

2 participants