.eventLog.BackgroundQueue(intervalSecsopt)

This class enables pending callbacks to fire all at once, on a synchronized schedule instead of one by one. This is useful to group operations that wake up expensive resources such as a mobile radio.

Constructor

new mw.eventLog.BackgroundQueue(intervalSecsopt) #

Example

enqueue = ( new BackgroundQueue() ).add;
...
enqueue( callback );
// callbacks will be fired in batches every 30 seconds (default)

Parameters:

Name Type Attributes Default Description
intervalSecs number <optional>
30

seconds to wait before calling callbacks

Source:

Methods

flush(fn) #

Add a callback to the queue, to be flushed when the timer runs out.

Parameters:

Name Type Description
fn function

Callback to add

Source:
Add a callback to the queue, to be flushed when the timer runs out.

flush() #

Manually execute all the callbacks, same as if the timer runs out.

Source:
Manually execute all the callbacks, same as if the timer runs out.