timer question
hi guys,
im new to this, just want to ask where are Timer objects usually
put.
i have a Screensaver (the view), ScreensaverModel,
ScreensaverEvent, and ScreensaverMediator.
thanks,
carlos
Comments are currently closed for this discussion. You can start a new one.
2 Posted by Matan Uberstein on 10 May, 2012 09:12 AM
Hi,
It depends on what the timer will be used for. From your naming I'm guessing a Screensaver. :)
In a case like this I'll put it into the Model. The Timer will then trigger the state change within the model, which in-turn should trigger the view changes.
Hope that makes sense!
3 Posted by matt on 10 May, 2012 09:30 AM
i would put the timer in your model tier, as it's part of the application's overall state. model then dispatches timer related events to rest of application
4 Posted by kakarlus on 10 May, 2012 09:40 AM
but the event listeners TIMER_COMPLETE and TIMER are to be put inside the Mediator right?
thanks
5 Posted by matt on 10 May, 2012 10:03 AM
yes you would listen for the application events in the mediator and act on your view accordingly
6 Posted by kakarlus on 10 May, 2012 10:20 AM
is it ok if i have my timer events in the model, and dispatch another custom event for the view? thank you so much for your time.
7 Posted by Matt Sayers on 10 May, 2012 10:51 AM
yup don't see why not! probably better to use a custom event for
application specific purposes anyway - gives you more flexibility and
control in terms of what else you might want to send along with the event.
8 Posted by kakarlus on 10 May, 2012 11:03 AM
i see, just as i thought. :D
im now curious how my model is instantiated :s
Ondina D.F. closed this discussion on 16 May, 2012 09:58 AM.