Git Product home page Git Product logo

Comments (3)

jri avatar jri commented on June 5, 2024

@maxkfranz What do you think about the commands function returning a promise?

Alternative: manipulate the commands dynamically while the menu is open, e.g. disabling a command.

from cytoscape.js-cxtmenu.

maxkfranz avatar maxkfranz commented on June 5, 2024

Personally, I don't think it would work well unless you show the intermediate loading state somehow. Waiting for a potentially long async op to complete to show anything, like the menu, could give bad ux.

Your idea could be implemented by adding menu.disable(), menu.enable(), and menu.updateCommands() etc. to the returned menu object -- rather than introducing async directly to the extension.

Anyway, it's an interesting idea but it's not something that I have time to implement myself any time soon.

from cytoscape.js-cxtmenu.

jri avatar jri commented on June 5, 2024

I plan to provide a pull request realizing the promise approach very soon. It will be fully compatible with current API and will have no performance impact.

Async does not necessarily imply a long operation (no server request might be involved at all) and bad ux. The app developer is still free to provide a load indicator if due.

From my perspective the other approach -- extending the API -- would be both harder to implement in the extension, and harder to use by the app developer (as she must relate the async response to an open menu somehow).

from cytoscape.js-cxtmenu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.