Code Monkey home page Code Monkey logo

Comments (6)

ttytm avatar ttytm commented on July 29, 2024 1

Regarding providing an example. An API for unbinding could be provided theoretically. So if there is a good use-case maybe its gonna be added.

from webui.

hassandraga avatar hassandraga commented on July 29, 2024 1

A propre unbind will be removing the ID from the core's table, and from webui.js as well, new internal cmd is needed, and a new API. Need time to implement, but good to have.

Thank you @xland for the suggestion.

from webui.

fibodevy avatar fibodevy commented on July 29, 2024

You cant unbind it, but you can "ignore" events for specific IDs in your app

from webui.

AlbertShown avatar AlbertShown commented on July 29, 2024

How do I unbind it?

The webui.js get generated at runtime based on your bind elements, and you can not unbind it. But, as @fibodevy said, you can easily ignore it in your back-end app.

what is the use of this ID?

Many wrappers has an internal table to map events with back-end functions, like Python wrapper, those wrappers use those IDs to identify the back-end function. So, you can save the IDs if you want and ignore their events later when you need, or use .element to get the bind name (element name) instead of ID, whatever you prefer.

from webui.

ttytm avatar ttytm commented on July 29, 2024

Yes, as you mention @xland, the call to webui_bind returns the ID. It is used e.g. to identify a function in an event. This would also allow to conditionally ignore the bound function when a state is reached where it is necessary, so you can store the ID and keep it in the relevant context.

Maybe you can share an example use-case for unbinding, then things can be further concertized.

from webui.

xland avatar xland commented on July 29, 2024

I didn't delve into the webui code.
So I'm not sure if it's necessary to add the webui_unbind API.

Let's say I'm going to keep creating btn in HTML : <button id='btn_n'>btn_n</button>.
And keep binding events to those buttons : webui_bind(winId, "btn_n", same_function);
Then keep removing the previously created Button : document.getElementById("btn_n").remove();

This could be what happens when the user switches between tab pages.
btn_1 may be repeatedly bound to an event.
btn_999999... may be bound to an event.

Does this cause OOM exception?

from webui.

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.