Comments (4)
I'm a bit confused about this, don't we need a special method for single shot connection, like singleShotConnect
? that gets disconnected after emit, which could be easily implemented just by having a set flag isSingleShot
in singleShotConnect
and each time when emit
gets called, it should check that emit was on a single shot connection and if that's the case immediately disconnects it? Don't need to get around connection handle.
from kdbindings.
That should work as well. I was just thinking that something like this should maybe be possible:
mySignal.connect([](const auto &handle) {
// do thing
handle.disconnect();
});
More of a thought experiment than anything substantial. An approach like that wouldn't need another connect
function and seems kind of elegantly recursive almost. It would even allow you to block the connect after it's first emitted, instead of disconnecting. It could then be unblocked again without having to reconnect. Might be useful for rate-limiting 🤔
But it's also incompatible with the current connect function I think, so don't know if it's worth continuing down.
Introducing a singleshotConnect
function definitely works as well, so that's the more likely route to go down.
Though something like connectReflective
would be cool, that allows you to reach your own ConnectionHandle...
That might run into weird lifetime issues though, where a lambda is deleted while in use, which could get quite hairy...
Anyhow, some food for thought.
from kdbindings.
The basics of reflective connections were layed out in #23, so we may want to revisit this idea :)
from kdbindings.
Related Issues (13)
- Draft - Multi-Threaded bindings HOT 1
- Draft - Deferred connection evaluation HOT 1
- Property move constructor cannot promise noexcept HOT 2
- Handle Cascading Bindings
- Allow having bindings referencing const Properties HOT 2
- Handling of members of aggregate types HOT 2
- Add `[[warn_unused_result]]` for ConnectionHandle HOT 3
- Add facilities for signal throttling and debouncing HOT 1
- Add include paths with capitalised paths HOT 4
- Add logging when dequeuing a deferred emission
- Use signal and slots in QML/Javascript HOT 5
- Clazy never fails CI HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kdbindings.