Hello,
you can’t initialize a listenable
interface inside a class.
For now, I recommend exposing an event like the CountdownEndedEvent
(for example OnTimerIteration
/OnTick
) that lets users of the class Await
it. You’d then Signal
the event when needed.
I haven’t played around with it much, but maybe something like this could also be helpful to you:
# In this case the functions we accept should take one string parameter and return void.
my_fun := type{_(:string):void}
my_subscribable := class:
var Funs<private>:[]my_fun = array{}
Subscribe<public>(Fun:my_fun):void =
set Funs += array{Fun}
Dispatch<private>():void =
for (Fun:Funs):
Fun("Hello")