comparison xml/en/docs/njs/njs_api.xml @ 2203:56a8cfb422ae

Added setTimeout and clearTimeout for njs.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 26 Jun 2018 10:31:33 +0300
parents b91e766acbd4
children 001f2d905fd9
comparison
equal deleted inserted replaced
2202:b91e766acbd4 2203:56a8cfb422ae
581 581
582 </section> 582 </section>
583 583
584 </section> 584 </section>
585 585
586 <section id="njs_api_timers" name="Timers">
587
588 <para>
589
590 <list type="tag">
591
592 <tag-name id="cleartimeout"><literal>clearTimeout(<value>timeout</value>)</literal></tag-name>
593 <tag-desc>
594 Cancels a <literal>timeout</literal> object
595 created by <link id="settimeout">setTimeout()</link>.
596 </tag-desc>
597
598 <tag-name id="settimeout"><literal>setTimeout(<value>function</value>,
599 <value>ms</value>[, <value>arg1</value>, <value>argN</value>])</literal></tag-name>
600 <tag-desc>
601 Calls a <literal>function</literal>
602 after a specified number of <literal>milliseconds</literal>.
603 One or more optional <literal>arguments</literal>
604 can be passed to the specified function.
605 Returns a <literal>timeout</literal> object.
606 <example>
607 function handler(v)
608 {
609 // ...
610 }
611
612 t = setTimeout(handler, 12);
613
614 // ...
615
616 clearTimeout(t);
617 </example>
618 </tag-desc>
619
620 </list>
621 </para>
622
623 </section>
624
586 </section> 625 </section>
587 626
588 627
589 <section id="http" name="HTTP Request"> 628 <section id="http" name="HTTP Request">
590 629