backbone-poller icon indicating copy to clipboard operation
backbone-poller copied to clipboard

How about to have a call back beforeStart?

Open cardinal27513 opened this issue 14 years ago • 4 comments

Have a need to do some tasks every time right before the poller start polling Can you add the beforeStart callback?

Thanks

cardinal27513 avatar May 13 '12 23:05 cardinal27513

Do you have a use case for this? It seems like, since you have to explicitly call start(), it's trivial to call your routine when you call start(). Is there a reason we should have a callback for it?

uzikilon avatar May 14 '12 22:05 uzikilon

But calling start() is a one shot deal in the beginning. After that, the timer periodically fires. Want to have a way to do some “pre-polling” processing or I will image that this will be async call back, it is more of set off some other tasks and then the poller will go onto its normal business and poll the server for data.

In this way, we can leverage the poller’s periodic timer and allow hook to some other tasks in beginning of every poll.

cardinal27513 avatar May 16 '12 02:05 cardinal27513

Oh, so you mean pre-fetch, not pre-start. I guess it makes sense to add an event for that.

uzikilon avatar May 16 '12 20:05 uzikilon

thanks.

cardinal27513 avatar May 17 '12 02:05 cardinal27513