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 have a Pointer class with a Signal, down. When the pointer is clicked down, the down signal dispatches. In this case I am creating a new Scene in the game that is registering new slots with the down signal. These new slots are fired immediately. That is no good for me because the Scene is brand new and the player clicked the mouse before the scene was created. Ideally, the signals would not dispatch to the new slots/listeners.
In writing this, I have figured out a workaround that will work in this case, but I would prefer signals to simply not dispatch immediately as this is unlikely to be the only instance that this occurs.
My thoughts on how to solve this are:
Add a _dispatching variable and set it to true while dispatching...
When listeners are added while dispatching, store them in a temporary list
When finished dispatching, then add them to the slot list
EventSignals don't work in my case either as I am piggybacking off of two separate event systems (pixijs and openfl) which already handle everything I need. I am simply unifying the interfaces.
The text was updated successfully, but these errors were encountered:
IkonOne
changed the title
Signals added while dispatching are dispatched.
Listeners added while dispatching are dispatched.
Mar 26, 2017
My use case:
I have a Pointer class with a Signal, down. When the pointer is clicked down, the down signal dispatches. In this case I am creating a new Scene in the game that is registering new slots with the down signal. These new slots are fired immediately. That is no good for me because the Scene is brand new and the player clicked the mouse before the scene was created. Ideally, the signals would not dispatch to the new slots/listeners.
In writing this, I have figured out a workaround that will work in this case, but I would prefer signals to simply not dispatch immediately as this is unlikely to be the only instance that this occurs.
My thoughts on how to solve this are:
EventSignals don't work in my case either as I am piggybacking off of two separate event systems (pixijs and openfl) which already handle everything I need. I am simply unifying the interfaces.
The text was updated successfully, but these errors were encountered: