UNPKG

chronoman

Version:

Utility class to simplify use of timers created by setTimeout

3,982 lines (1,407 loc) 79.5 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>chronoman Class: Timer</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.spacelab.css"> </head> <body> <div class="navbar navbar-default navbar-fixed-top "> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="index.html">chronoman</a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse" id="topNavigation"> <ul class="nav navbar-nav"> <li class="dropdown"> <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="module-chronoman.html">chronoman</a></li> </ul> </li> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="module-chronoman-Timer.html">chronoman~Timer</a></li> </ul> </li> </ul> <div class="col-sm-3 col-md-3"> <form class="navbar-form" role="search"> <div class="input-group"> <input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> <div class="input-group-btn"> <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> </div> </div> </div> </div> <div class="container" id="toc-content"> <div class="row"> <div class="col-md-8"> <div id="main"> <h1 class="page-title">Class: Timer</h1> <section> <header> <h2> <span class="ancestors"><a href="module-chronoman.html">chronoman</a>~</span> Timer </h2> </header> <article> <div class="container-overview"> <hr> <dt> <h4 class="name" id="Timer"><span class="type-signature"></span>new Timer( [initValue])</h4> </dt> <dd> <div class="description"> <p>Utility class to simplify use of timers created by setTimeout.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>initValue</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Specifies initial property values. Keys are property names, their values are values of corresponding properties. See <a href="module-chronoman-Timer.html#setProperties">setProperties</a> for details.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-114">line 114</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#setProperties">setProperties</a></li> </ul> </dd> </dl> </dd> </div> <h3 class="subsection-title">Members</h3> <dl> <hr> <dt class="name" id="_action"> <h4 id="_action"><span class="type-signature">&lt;protected> </span>_action<span class="type-signature"> :<a href="module-chronoman.html#~Action">module:chronoman~Action</a></span></h4> </dt> <dd> <div class="description"> <p>Related action that should be executed after time period is elapsed. <br> Can be a function, an object having <code>execute</code> method or an object with fields <code>func</code> (function that will be executed) and <code>context</code> (<code>this</code> for function's call). <br> The timer instance to which the action is associated will be passed as function's/method's parameter if <a href="module-chronoman-Timer.html#setPassToAction">passToAction</a> property is set to <code>true</code>.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="module-chronoman.html#~Action">module:chronoman~Action</a></span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-660">line 660</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_active"> <h4 id="_active"><span class="type-signature">&lt;protected> </span>_active<span class="type-signature"> :Boolean</span></h4> </dt> <dd> <div class="description"> <p>Indicates whether timer is in use.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Boolean</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-560">line 560</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_data"> <h4 id="_data"><span class="type-signature">&lt;protected> </span>_data<span class="type-signature"> :*</span></h4> </dt> <dd> <div class="description"> <p>Auxiliary data associated with the timer instance.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">*</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-366">line 366</a> </li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_executeTime"> <h4 id="_executeTime"><span class="type-signature"></span>_executeTime<span class="type-signature"> :Array.&lt;Integer></span></h4> </dt> <dd> <div class="description"> <p>List that contain times when <a href="module-chronoman-Timer.html#execute">execute</a> was called.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Array.&lt;Integer></span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-539">line 539</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_executionQty"> <h4 id="_executionQty"><span class="type-signature">&lt;protected> </span>_executionQty<span class="type-signature"> :Integer</span></h4> </dt> <dd> <div class="description"> <p>Specifies how many times action was executed.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Integer</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-403">line 403</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> <li><a href="module-chronoman-Timer.html#setActive">setActive</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_passToAction"> <h4 id="_passToAction"><span class="type-signature">&lt;protected> </span>_passToAction<span class="type-signature"> :Boolean</span></h4> </dt> <dd> <div class="description"> <p>Indicates whether the timer instance (<code>this</code>) should be passed into action function when the function is called.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Boolean</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-696">line 696</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_period"> <h4 id="_period"><span class="type-signature">&lt;protected> </span>_period<span class="type-signature"> :<a href="module-chronoman.html#~PeriodValue">module:chronoman~PeriodValue</a></span></h4> </dt> <dd> <div class="description"> <p>Time period in milliseconds, object specifying random time period, array of periods or function that returns period or array of periods. A related action will be executed when the period is elapsed. <br> When an object is set the used period is selected randomly. The object can have the following properties:</p> <ul> <li><code>list</code> - a non-empty array of integer numbers from which the period will be selected randomly.</li> <li><code>start</code> - an integer number representing minimal point of interval from which random time period should be generated; default value - 0.</li> <li><code>end</code> - an integer number representing maximal point of interval from which random time period should be generated; default value - <code>start + 1000</code>.</li> </ul> <br> When array of periods is set the used period is selected in the following way: first array item (with index 0) specifies period before first action's execution, second array item (with index 1) specifies period before second action's execution, and so on. When quantity of action executions is more than array's length the last item of array is used as period for subsequent executions. <br> When function is set its returned value is used to determine next period. The timer instance to which the function is associated will be passed as function's parameter. When function returns an array of periods the array is used to select period before next execution according to rules described above. </div> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="module-chronoman.html#~PeriodValue">module:chronoman~PeriodValue</a></span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-171">line 171</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> <li><a href="module-chronoman-Timer.html#setActive">setActive</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_recurrent"> <h4 id="_recurrent"><span class="type-signature">&lt;protected> </span>_recurrent<span class="type-signature"> :Boolean</span></h4> </dt> <dd> <div class="description"> <p>Indicates whether related action should be executed repeatedly.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Boolean</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-250">line 250</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> <li><a href="module-chronoman-Timer.html#setActive">setActive</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_repeatQty"> <h4 id="_repeatQty"><span class="type-signature">&lt;protected> </span>_repeatQty<span class="type-signature"> :Integer</span></h4> </dt> <dd> <div class="description"> <p>Specifies how many times related action should be repeated after first execution.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Integer</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-287">line 287</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> <li><a href="module-chronoman-Timer.html#setActive">setActive</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_repeatTest"> <h4 id="_repeatTest"><span class="type-signature">&lt;protected> </span>_repeatTest<span class="type-signature"> :function</span></h4> </dt> <dd> <div class="description"> <p>Specifies function that should be called after action execution to determine whether execution should be repeated. If the function returns a true value or non-negative number it means that execution will be repeated. When the function returns non-negative number, array, object or function this value will be used to calculate time period in milliseconds to schedule next action execution (see <a href="module-chronoman-Timer.html#getPeriodValue">getPeriodValue</a>). <br> The timer instance to which the test is associated will be passed as function's parameter.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">function</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-331">line 331</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> <li><a href="module-chronoman-Timer.html#setActive">setActive</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_startTime"> <h4 id="_startTime"><span class="type-signature">&lt;protected> </span>_startTime<span class="type-signature"> :Integer|null</span></h4> </dt> <dd> <div class="description"> <p>Time when timer was set active (was started).</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Integer</span> | <span class="param-type">null</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-496">line 496</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#setActive">setActive</a></li> <li><a href="module-chronoman-Timer.html#start">start</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_stopTime"> <h4 id="_stopTime"><span class="type-signature">&lt;protected> </span>_stopTime<span class="type-signature"> :Integer|null</span></h4> </dt> <dd> <div class="description"> <p>Time when timer was set inactive (was stopped).</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Integer</span> | <span class="param-type">null</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-519">line 519</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#setActive">setActive</a></li> <li><a href="module-chronoman-Timer.html#start">stop</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="_timeoutId"> <h4 id="_timeoutId"><span class="type-signature">&lt;protected> </span>_timeoutId<span class="type-signature"> :Integer</span></h4> </dt> <dd> <div class="description"> <p>Timer id.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Integer</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-440">line 440</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_clearTimeout">_clearTimeout</a></li> <li><a href="module-chronoman-Timer.html#_setTimeout">_setTimeout</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="actionResult"> <h4 id="actionResult"><span class="type-signature"></span>actionResult<span class="type-signature"> :*</span></h4> </dt> <dd> <div class="description"> <p>Result of <a href="module-chronoman-Timer.html#_action">action</a>'s last execution.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">*</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-827">line 827</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_action">action</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="onExecute"> <h4 id="onExecute"><span class="type-signature"></span>onExecute<span class="type-signature"> :function</span></h4> </dt> <dd> <div class="description"> <p>Function that should be executed after time period is elapsed. <br> The timer instance to which the function is associated will be passed as function's parameter if <a href="module-chronoman-Timer.html#setPassToAction">passToAction</a> property is set to <code>true</code>.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">function</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-838">line 838</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id="onExecuteResult"> <h4 id="onExecuteResult"><span class="type-signature"></span>onExecuteResult<span class="type-signature"> :*</span></h4> </dt> <dd> <div class="description"> <p>Result of <a href="module-chronoman-Timer.html#onExecute">onExecute</a> last execution.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">*</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-846">line 846</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#onExecute">onExecute</a></li> </ul> </dd> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <hr> <dt> <h4 class="name" id="_clearTimeout"><span class="type-signature">&lt;protected> </span>_clearTimeout()</h4> </dt> <dd> <div class="description"> <p>Cancel execution of scheduled action.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-478">line 478</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_setTimeout">_setTimeout</a></li> <li><a href="module-chronoman-Timer.html#_timeoutId">_timeoutId</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Reference to <code>this</code> object.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="_onTimeoutEnd"><span class="type-signature">&lt;protected> </span>_onTimeoutEnd()</h4> </dt> <dd> <div class="description"> <p>Handle timeout's end.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-129">line 129</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_timeoutId">_timeoutId</a></li> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> </ul> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="_setTimeout"><span class="type-signature">&lt;protected> </span>_setTimeout( [timeout])</h4> </dt> <dd> <div class="description"> <p>Schedule related action execution.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>timeout</code></td> <td class="type"> <span class="param-type"><a href="module-chronoman.html#~PeriodValue">module:chronoman~PeriodValue</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Time period that is used to schedule action execution. By default the current value of <a href="module-chronoman-Timer.html#getPeriod">period</a> property is used to determine time period.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-459">line 459</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_clearTimeout">_clearTimeout</a></li> <li><a href="module-chronoman-Timer.html#_onTimeoutEnd">_onTimeoutEnd</a></li> <li><a href="module-chronoman-Timer.html#_timeoutId">_timeoutId</a></li> <li><a href="module-chronoman-Timer.html#execute">execute</a></li> <li><a href="module-chronoman-Timer.html#getPeriodValue">getPeriodValue</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Reference to <code>this</code> object.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="dispose"><span class="type-signature"></span>dispose()</h4> </dt> <dd> <div class="description"> <p>Free resources that are allocated for object.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-933">line 933</a> </li> </ul> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="execute"><span class="type-signature"></span>execute()</h4> </dt> <dd> <div class="description"> <p>Execute related action (function). <br> The timer instance to which the action is associated will be passed as function's parameter if <a href="module-chronoman-Timer.html#setPassToAction">passToAction</a> property is set to <code>true</code>. <br> Action's next execution will be scheduled when one of the following conditions is true:</p> <ul> <li>timer is set as recurrent (see <a href="module-chronoman-Timer.html#isRecurrent">isRecurrent</a>); <li>specified quantity of repeats is not reached (see <a href="module-chronoman-Timer.html#getRepeatQty">getRepeatQty</a>); <li>specified repeat test is passed i.e. the test function returns true value or non-negative number (see <a href="module-chronoman-Timer.html#getRepeatTest">getRepeatTest</a>); </ul> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-874">line 874</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_active">_active</a></li> <li><a href="module-chronoman-Timer.html#_executionQty">_executionQty</a></li> <li><a href="module-chronoman-Timer.html#getAction">getAction</a></li> <li><a href="module-chronoman-Timer.html#getRepeatQty">getRepeatQty</a></li> <li><a href="module-chronoman-Timer.html#getRepeatTest">getRepeatTest</a></li> <li><a href="module-chronoman-Timer.html#isActive">isActive</a></li> <li><a href="module-chronoman-Timer.html#isPassToAction">isPassToAction</a></li> <li><a href="module-chronoman-Timer.html#isRecurrent">isRecurrent</a></li> <li><a href="module-chronoman-Timer.html#onExecute">onExecute</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Reference to <code>this</code> object.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getAction"><span class="type-signature"></span>getAction()</h4> </dt> <dd> <div class="description"> <p>Return value that represents action.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-670">line 670</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_action">_action</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Function that represents action.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-chronoman.html#~Action">module:chronoman~Action</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getData"><span class="type-signature"></span>getData()</h4> </dt> <dd> <div class="description"> <p>Return auxiliary data associated with the timer instance.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-376">line 376</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_data">_data</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Auxiliary data associated with the timer instance.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getExecuteTime"><span class="type-signature"></span>getExecuteTime()</h4> </dt> <dd> <div class="description"> <p>Return list that contain times when <a href="module-chronoman-Timer.html#execute">execute</a> was called.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-549">line 549</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_executeTime">_executeTime</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>List that contain times when <a href="module-chronoman-Timer.html#execute">execute</a> was called.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;Integer></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getExecutionQty"><span class="type-signature"></span>getExecutionQty()</h4> </dt> <dd> <div class="description"> <p>Return the value that indicates how many times action was executed.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-413">line 413</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_executionQty">_executionQty</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Value that indicates how many times action was executed.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Integer</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getPeriod"><span class="type-signature"></span>getPeriod()</h4> </dt> <dd> <div class="description"> <p>Return value determining time period that is used to schedule related action execution.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-181">line 181</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_period">_period</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Value determining time period.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-chronoman.html#~PeriodValue">module:chronoman~PeriodValue</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getPeriodValue"><span class="type-signature"></span>getPeriodValue( [value])</h4> </dt> <dd> <div class="description"> <p>Return time period that will be used to schedule related action execution.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type"><a href="module-chronoman.html#~PeriodValue">module:chronoman~PeriodValue</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> this.getPeriod() </td> <td class="description last"><p>Value that is used to calculation.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-212">line 212</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_period">_period</a></li> <li><a href="module-chronoman-Timer.html#getPeriod">getPeriod</a></li> <li><a href="module-chronoman-Timer.html#getExecutionQty">getExecutionQty</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Time period in milliseconds.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Integer</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getRepeatQty"><span class="type-signature"></span>getRepeatQty()</h4> </dt> <dd> <div class="description"> <p>Return the value that indicates how many times related action should be repeated after first execution.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-297">line 297</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_repeatQty">_repeatQty</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Value that indicates how many times related action should be repeated after first execution.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Integer</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getRepeatTest"><span class="type-signature"></span>getRepeatTest()</h4> </dt> <dd> <div class="description"> <p>Return the function that is used to determine whether action execution should be repeated.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-341">line 341</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_repeatTest">_repeatTest</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Function that is used to determine whether action execution should be repeated.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getStartTime"><span class="type-signature"></span>getStartTime()</h4> </dt> <dd> <div class="description"> <p>Return time when timer was set active.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-506">line 506</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_startTime">_startTime</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Time when timer was set active.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Integer</span> | <span class="param-type">null</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getStopTime"><span class="type-signature"></span>getStopTime()</h4> </dt> <dd> <div class="description"> <p>Return time when timer was set inactive.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-529">line 529</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_stopTime">_stopTime</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Time when timer was set inactive.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Integer</span> | <span class="param-type">null</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="isActive"><span class="type-signature"></span>isActive()</h4> </dt> <dd> <div class="description"> <p>Test whether timer is in use.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-570">line 570</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_active">_active</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p><code>true</code>, if timer is in use, otherwise <code>false</code>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="isPassToAction"><span class="type-signature"></span>isPassToAction()</h4> </dt> <dd> <div class="description"> <p>Test whether the timer instance should be passed into action function when the function is called.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-706">line 706</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_passToAction">_passToAction</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p><code>true</code>, if the timer instance should be passed, otherwise <code>false</code>.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="isRecurrent"><span class="type-signature"></span>isRecurrent()</h4> </dt> <dd> <div class="description"> <p>Test whether related action should be executed repeatedly.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="chronoman.js.html">chronoman.js</a>, <a href="chronoman.js.html#sunlight-1-line-260">line 260</a> </li> </ul> </dd> <dt class="tag-see method-doc-label method-doc-details-label">See:</dt> <dd class="tag-see"> <ul> <li><a href="module-chronoman-Timer.html#_recurrent">_recurrent</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div cl