Files
fusionpbx/resources
Alexey Melnichuk 1834be5042 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-30 19:31:24 -06:00
2016-05-05 20:10:19 -06:00
2016-04-25 20:30:23 -05:00
2016-03-11 13:57:01 +00:00
2016-07-06 13:10:12 -06:00
2016-05-10 17:25:20 -06:00
2013-07-06 05:23:01 +00:00
2016-04-25 20:30:23 -05:00
2016-03-11 13:57:01 +00:00
2016-03-11 13:57:01 +00:00
2016-04-29 11:21:26 -06:00
2016-05-05 14:18:59 -06:00
2016-03-11 13:57:01 +00:00