Steven W. Riggins
2005-12-26 20:40:01 UTC
I'm struggling with when to use tweak scripts and events.
I have a class system where I have channels, which hold on to
events. When the timeline starts, it puts the events on a
scheduler. When the scheduler starts an event, it sends startEvent
to the event.
Now the event can do what it needs to, show, start media etc. It
also does a self signal: eventStarted.
the channel has started a script to listen for these:
self startScript: #eventStarted:
withArguments:{anEvent}
when:{anEvent. #eventStarted}.
Now if I run the following code one line at a time in a tweak
workspace, the result is 1 (correct) when I run it under one doit,
the result is 0. I am sure this is due to asynchronous events.
The question is: How do I know when events get sent? is this a good
use of events?
When I wrote an SUnit to test this, it failed of course, as the event
had not been triggered yet.
Thanks for the insight!
Steve
I have a class system where I have channels, which hold on to
events. When the timeline starts, it puts the events on a
scheduler. When the scheduler starts an event, it sends startEvent
to the event.
Now the event can do what it needs to, show, start media etc. It
also does a self signal: eventStarted.
the channel has started a script to listen for these:
self startScript: #eventStarted:
withArguments:{anEvent}
when:{anEvent. #eventStarted}.
Now if I run the following code one line at a time in a tweak
workspace, the result is 1 (correct) when I run it under one doit,
the result is 0. I am sure this is due to asynchronous events.
The question is: How do I know when events get sent? is this a good
use of events?
When I wrote an SUnit to test this, it failed of course, as the event
had not been triggered yet.
Thanks for the insight!
Steve