Files
fusionpbx/resources/install/scripts
Alexey Melnichuk 9076df2302 Add. Support onInterval method to EventConsumer class (#1747)
* Add. Support `onInterval` method to EventConsumer class

Usage
```Lua
-- execute action each 30 sec
events:onInterval(30*1000, function() end)

-- execute action once after 5 min
events:onIntervalOnce(5*60*1000, function() end)
```

* Fix. Remove timers

* Fix. Reset timer before callback

It allows stop timer inside callback.
Also it produce more accurate interval invocation
if callback take quite a long time.
E.g. Interval = 10 sec and callback took 5 sec then
if we reset timer after this callback then gap between
invocation will be 15 sec.

* Add. Timers now have TimeEvent class type.

Add. `reset` method to IntervalTimer class.

```Lua
events:onIntervalOnce(1000, function(self, timer)
  -- timer has type TimeEvent

  -- restart timer so it will be invoke again
  timer:restart()

  -- or reset new interval
  -- timer:reset(5000)
end)
```

* Fix. Typo in variable name
2016-07-13 09:43:51 -06:00
..
2016-06-12 14:14:52 -06:00
2015-08-11 14:40:02 +04:00
2016-02-24 19:59:54 -05:00
2015-11-05 18:02:08 +03:00
2016-05-12 23:06:45 -06:00
2016-07-06 14:48:00 -06:00
2014-07-31 08:40:15 +00:00