Make fireEvent function async so that it can be awaited for the attached triggers to complete

Say I have a custom widget that executes a loop - like the regular looper custom widget from the library.

At present, if I have a trigger sequence in the looper action event, the looper widget will just simulate its progress by waiting x ms until it moves the progress bar forward.

Now imagine we have a complex trigger sequence in there… It is no longer feasible to just wait x ms because you do not know how long that trigger sequence will need to complete.

Is it possible to make that fireEvent call support async so that we can await the event that is fired to complete before we continue executing the loop?

Hey sebme – interesting idea, that would certainly make the looper widgets much cleaner. If the event caused a step transition that then ran step open triggers – would you expect the fireEvent function to return at the transition, or after all of the step open triggers (and further step transitions) happened?

hmm :slight_smile: That’s an interesting questions. I would assume it should return at the transition because given the way Tulip is structured (no parallel execution possible) I would consider a transition event a game over / hard exit point where basically you are leaving the widget all together.

Hmm, good point. If the step transitions, the widget likely won’t even be rendering anymore in order to handle the callback.

Thanks for your thoughts on this. I’ve turned it into a feature request ticket internally

1 Like