Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Improvements to events #3210
Copying in @havocp's comment:
We could model events as state changes (imagine model fields like latest_event or click_count, then you watch those for change). But that would be awkward, at least if it were the only API - maybe it would be fine on the protocol/implementation level, I don't know.
Some things will not work well if done server side, for example I think if you did any kind of click-and-drag functionality with server side callbacks for the click and drag events, it would probably work poorly. But other things like clicking a button I imagine would work very well with server-side callbacks.
I could imagine a mechanism not unlike properties.py, or maybe part of properties.py, for registering events that a class can generate? It could automatically create a corresponding property which would be the list of client-side callbacks...
That sounds similar to how I currently do "events" in Flexx, using a Reactive-Programming-like approach. I'm actually starting to think that RP is not a very good model for widget systems, especially visualization oriented apps. Here is my proposal for changing Flexx' event system. Basically, I want to make things more simple/classical, but keep some of the niceties of the current system, such as the easy way to bind functions to events. It would also mean that Flexx moves from "signals" to properties, which makes me wonder about compatibility with Bokeh ...
This is very much what I had in mind for Flexx as well. I think that it makes sense that for each property there is a corresponding event that gets fired when that property changes, and that other events can be defined in a similar way.