Closed metincansiper closed 8 years ago
Yes, the extension should not assume a global reference.
Use var myCy = this
in a core function or var myCy = this.cy()
in a collection function.
I am accessing cy in core and collection functions as you described. However, I realized that there were some cases where I was not accessing it properly and this problems were unseen in demo files because of the reason that a global cy instance exists. I needed to make sure that extensions should not assume a global reference before fixing that bug. The bug seems to be fixed now. Thanks for your reply.
The demo files in extensions which are generated by 'https://github.com/cytoscape/slush-cytoscape-extension' sets 'window.cy' as the following 'var cy = window.cy = cytoscape({...'. Therefore, in demo file of this extension this problem is not occuring, but if I change this line so that 'window.cy' is not set the problem occurs.
@maxkfranz is 'window.cy' is set just for debuging purposes in generated 'demo.html' files. If not is it expected that users should set it like it is done in 'demo' files after creating 'cytoscape' instance?
I think that if the first case is true then this is a bug of this extension. However, if the second case is true then there is no problem with this.