Giter Site home page Giter Site logo

Comments (3)

wqking avatar wqking commented on June 5, 2024

Hi, what's the use case to remove all callbacks from a CallbackList? You may simply assign an empty CallbackList to the existing one to "clear" it, isn't it enough?
Note if we add such "clear" function in CallbackList, we also need to add similar functions to EventDispatcher and EventQueue, to keep the API consistent.

from eventpp.

vebjornjr avatar vebjornjr commented on June 5, 2024

The use-case is when a ComponentA har registered several callbacks with a ComponentB (which uses CallbackList internally). Often we want to unsubscribe (remove) the callbacks as the first step in the destructor of ComponentA so that it no longes receives callbacks. ScopedRemover will not work (as I see it) since we want to remove the callbacks before doing other clean-up in the destructor.

I will take a look at assigning an empty CallbackList.

from eventpp.

wqking avatar wqking commented on June 5, 2024

After careful consideration, I think it's not necessary to add such function.
There are several alternatives to achieve this,
1, Assign the existing CallbackList with an empty CallbackList.
2, Or use the reset function in ScopedRemover.

from eventpp.

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.