You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Reactive Banana with gi-gtk to build a GUI application. I want to create a widget in response to an event and have that widget respond to changes in a Behavior and generate events for output. However I have a space-time leak from the interaction of reactimate with execute.
--| Display the value in the behavior and emit events -- in response to user actions.makeMyWidget::BehaviorDisplayValue->MomentIO (Widget, EventEdit)
--| Extract data specified by Foo into DisplayValuegetDisplay::Foo->AppState->DisplayValuetriggerEvent::EventFoo-- The event that causes the widget to appear.globalState::BehaviorAppState--| Add the argument to the GUI widget tree, dstroying any previous one.showWidgetInGui::Widget->IO()
This seems to work fine. Every time the triggerEvent happens a new window pops up containing data extracted from globalState.
However when I trace the execution of getDisplay I see it being run for every past invocation as well as the one currently displayed. Presumably this is because the makeMyWidget includes reactimate' calls to update its display from the input behavior.
execute allows me to dynamically add processing to the event network, but I can't see any way of dynamically pruning old processing that is no longer needed.
I'm thinking of an API along the following lines:
--| A reference to an existing "reactimate"dataCookie--| The same as the existing function, but returning a cookie.reactimate::Event (IO()) ->MomentIO (Cookie)
--| Dynamically remove a reactimate from the network.stopReactimate::Cookie->IO()
With this I could put a bunch of reactimate calls inside an execute, collect all their cookies, and then have the corresponding stopReactimate calls as a callback from the destruction of the widget that they were updating. Having stopReactimate in the IO monad makes it easy to put in a callback like this. The data structures associated with the reactimate should also be cleared or dropped to allow the widget to be garbage collected along with everthing else.
The text was updated successfully, but these errors were encountered:
I'm using Reactive Banana with gi-gtk to build a GUI application. I want to create a widget in response to an event and have that widget respond to changes in a
Behavior
and generate events for output. However I have a space-time leak from the interaction ofreactimate
withexecute
.So now I can write this:
This seems to work fine. Every time the
triggerEvent
happens a new window pops up containing data extracted fromglobalState
.However when I trace the execution of
getDisplay
I see it being run for every past invocation as well as the one currently displayed. Presumably this is because themakeMyWidget
includesreactimate'
calls to update its display from the input behavior.execute
allows me to dynamically add processing to the event network, but I can't see any way of dynamically pruning old processing that is no longer needed.I'm thinking of an API along the following lines:
With this I could put a bunch of
reactimate
calls inside anexecute
, collect all their cookies, and then have the correspondingstopReactimate
calls as a callback from the destruction of the widget that they were updating. HavingstopReactimate
in the IO monad makes it easy to put in a callback like this. The data structures associated with thereactimate
should also be cleared or dropped to allow the widget to be garbage collected along with everthing else.The text was updated successfully, but these errors were encountered: