cytoscape / slush-cytoscape-extension

A Cytoscape.js extension generator
MIT License
10 stars 5 forks source link

Discrete layout class template file throws TypeError #12

Closed d2fong closed 7 years ago

d2fong commented 7 years ago

Using cytoscape 3.1.4

When creating a new layout extension, I get the following error once I register the layout and try to run it.

Uncaught TypeError: Class constructor Layout cannot be invoked without 'new'
    at o (cytoscape.min.js:39)
    at u.layout (cytoscape.min.js:32)
    at u.layout (cytoscape.min.js:27)
    at a.<anonymous> (demo.html:108)
    at e (lodash.min.js:68)
    at o (lodash.min.js:68)
    at i (lodash.min.js:68)
o @ cytoscape.min.js:39
layout @ cytoscape.min.js:32
layout @ cytoscape.min.js:27
(anonymous) @ demo.html:108
e @ lodash.min.js:68
o @ lodash.min.js:68
i @ lodash.min.js:68
maxkfranz commented 7 years ago

@d2fong Does 872ea70 help? It should work around the issue by having Babel convert class to function, but we should probably address this in the core lib as well.

d2fong commented 7 years ago

@maxkfranz it doesn't throw an error anymore once I add .babelrc but I don't think it is working properly. The layout doesn't seem to run when I call it.

maxkfranz commented 7 years ago

Saving the default options is missing from the scaffolder: https://github.com/cytoscape/slush-cytoscape-extension/blob/master/templates/src/layout/discrete.js#L26