timer question

kakarlus's Avatar


10 May, 2012 07:40 AM

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.


  1. 1 Posted by Matan Uberstein on 10 May, 2012 09:12 AM

    Matan Uberstein's Avatar


    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!

  2. 2 Posted by matt on 10 May, 2012 09:30 AM

    matt's Avatar

    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

  3. 3 Posted by kakarlus on 10 May, 2012 09:40 AM

    kakarlus's Avatar

    but the event listeners TIMER_COMPLETE and TIMER are to be put inside the Mediator right?


  4. 4 Posted by matt on 10 May, 2012 10:03 AM

    matt's Avatar

    yes you would listen for the application events in the mediator and act on your view accordingly

  5. 5 Posted by kakarlus on 10 May, 2012 10:20 AM

    kakarlus's Avatar

    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.

  6. 6 Posted by Matt Sayers on 10 May, 2012 10:51 AM

    Matt Sayers's Avatar

    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.

  7. 7 Posted by kakarlus on 10 May, 2012 11:03 AM

    kakarlus's Avatar

    i see, just as i thought. :D

    im now curious how my model is instantiated :s

  8. Ondina D.F. closed this discussion on 16 May, 2012 09:58 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac