comparison xml/en/docs/stream/ngx_stream_js_module.xml @ 2686:45214e5316cd

Improved description of js_set.
author Yaroslav Zhuravlev <yar@nginx.com>
date Fri, 19 Mar 2021 18:24:34 +0000
parents 8751cab1d562
children 3cbd6e440581
comparison
equal deleted inserted replaced
2685:5282d6d3d849 2686:45214e5316cd
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> 7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
8 8
9 <module name="Module ngx_stream_js_module" 9 <module name="Module ngx_stream_js_module"
10 link="/en/docs/stream/ngx_stream_js_module.html" 10 link="/en/docs/stream/ngx_stream_js_module.html"
11 lang="en" 11 lang="en"
12 rev="24"> 12 rev="25">
13 13
14 <section id="summary"> 14 <section id="summary">
15 15
16 <para> 16 <para>
17 The <literal>ngx_stream_js_module</literal> module is used to implement 17 The <literal>ngx_stream_js_module</literal> module is used to implement
257 <value>module.function</value></syntax> 257 <value>module.function</value></syntax>
258 <default/> 258 <default/>
259 <context>stream</context> 259 <context>stream</context>
260 260
261 <para> 261 <para>
262 Sets an njs function for the specified variable. 262 Sets an njs <literal>function</literal>
263 Since <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>, 263 for the specified <literal>variable</literal>.
264 a module function can be referenced. 264 Since <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>,
265 a module function can be referenced.
266 </para>
267
268 <para>
269 The function is called when
270 the variable is referenced for the first time for a given request.
271 The exact moment depends on a
272 <link doc="stream_processing.xml">phase</link>
273 at which the variable is referenced.
274 This can be used to perform some logic
275 not related to variable evaluation.
276 For example, if the variable is referenced only in the
277 <link doc="ngx_stream_log_module.xml" id="log_format"/> directive,
278 its handler will not be executed until the log phase.
279 This handler can be used to do some cleanup
280 right before the request is freed.
265 </para> 281 </para>
266 282
267 </directive> 283 </directive>
268 284
269 </section> 285 </section>