iVis-at-Bilkent / cytoscape.js-context-menus

A Cytoscape.js extension to provide context menu around elements and core instance
MIT License
86 stars 41 forks source link

API collisions etc #4

Closed maxkfranz closed 8 years ago

maxkfranz commented 8 years ago

This extension writes many things to the global Core prototype. That means you can have collisions with other extensions. An extension is supposed to set only one field in the prototype of the core and/or collections -- the same as the extension name.

It would be better to have something like this:

let menu = cy.contextMenu({ /* options... */ }); 
// or
let menu = cy.$('#some-node').contextMenu({ /* options... */ });

menu.enable();
menu.disable();
menu.add( someItem );
menu.remove( someItem );
menu.destroy();

// etc...
metincansiper commented 8 years ago

You are right I will fix this.

metincansiper commented 8 years ago

@maxkfranz Now, the extension sets just one field (.contextMenus) in the core.

maxkfranz commented 8 years ago

Great! Thanks