new Interval(msecs, itemProduceropt, waitforFinishProduction, maxNumTriggers, triggerInitially, enabled)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
msecs |
number | |||
itemProducer |
producerHandler.<(T|Promise.<T>)> |
<optional> |
null | Optional. Defaults to null. A function that produces an item that shall then be signaled by the scheduler. If the item is not of importance, then you may just supply an empty function or null (will be converted to an empty function then). |
waitforFinishProduction |
boolean | true | if true, the interval will be reset only when the itemProducer finished producing its item. If this is false, the interval will be reset right away if it elapses. This makes sense if producing an item takes considerable amounts of time. | |
maxNumTriggers |
number | the maximum amount of times this interval shall trigger. Supply a negative value or Number.MAX_SAFE_INTEGER to not limit this interval to any amount of occurrences. | ||
triggerInitially |
boolean | if true, will trigger this interval right away, instead of waiting for the timeout to elapse once. | ||
enabled |
boolean | if true, this Interval is enabled. Otherwise, its events are ignored until it get enabled. |
- Source:
Methods
finalize() → {this}
Additionally to finish(), this method also disables this Interval.
- Source:
Returns:
this
- Type
- this
finish() → {this}
This method will ultimately set the number of occurences equal to the
number of how many times this Interval should have been triggered.
This leads to this Interval reporting that it is finished.
Attempting to finish an unbounded Interval will throw an Error.
- Source:
Throws:
-
if this is an unbounded Interval
- Type
- Error
Returns:
this
- Type
- this
(generator) preliminaryEvents(after, before) → {IterableIterator.<PreliminaryScheduleEvent.<Interval, undefined>>}
Parameters:
Name | Type | Description |
---|---|---|
after |
Date | Required. |
before |
Date |
- Source:
Returns:
- Type
- IterableIterator.<PreliminaryScheduleEvent.<Interval, undefined>>