PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: jamesshaji on February 09, 2012, 07:20:21



Title: perform repetitively at regular interval in PureMVC based project
Post by: jamesshaji on February 09, 2012, 07:20:21
Currently working on a AIR project based on PureMVC framework. There was a new requirement to the project, an operation is to be performed repetitively at regular interval which would have some business logic.

I would be placing the business logic in a command, but then question what comes up is where and who should be triggering this command at specific interval. As of now I have trigger to call command in a mediator. Is this correct?

How do I find a solution for this kind of scenario?


Title: Re: perform repetitively at regular interval in PureMVC based project
Post by: Tekool on February 11, 2012, 06:30:35
For my part I use a SchedulerProxy. It has a method which receives a notification name and a number of milliseconds as parameters. It dispatches the named notification every N milliseconds and so can be used by both Command or a Mediator. The proxy also have some methods to manage the scheduled notifications map. I think I use the notification name as an ID. It could be better built and use a unique interval ID. I even thought to publish this as a PureMVC Extension for JavaScript.


Title: Re: perform repetitively at regular interval in PureMVC based project
Post by: puremvc on February 12, 2012, 09:47:10
@Tekool, that's the right answer. Such a utility would be certainly handy off the shelf.