Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_js_module.xml @ 2882:986e1f930e3b
Documented server, location, if contexts for some js directives.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 18 Aug 2022 15:44:39 +0100 |
parents | a3aee2697d4e |
children | 9719a0184a67 |
comparison
equal
deleted
inserted
replaced
2881:e59e8645055d | 2882:986e1f930e3b |
---|---|
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | 7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
8 | 8 |
9 <module name="Module ngx_http_js_module" | 9 <module name="Module ngx_http_js_module" |
10 link="/en/docs/http/ngx_http_js_module.html" | 10 link="/en/docs/http/ngx_http_js_module.html" |
11 lang="en" | 11 lang="en" |
12 rev="35"> | 12 rev="36"> |
13 | 13 |
14 <section id="summary"> | 14 <section id="summary"> |
15 | 15 |
16 <para> | 16 <para> |
17 The <literal>ngx_http_js_module</literal> module is used to implement | 17 The <literal>ngx_http_js_module</literal> module is used to implement |
150 <directive name="js_body_filter"> | 150 <directive name="js_body_filter"> |
151 <syntax><value>function</value> | <value>module.function</value> | 151 <syntax><value>function</value> | <value>module.function</value> |
152 [<value>buffer_type</value>=<value>string</value> | <value>buffer</value>]</syntax> | 152 [<value>buffer_type</value>=<value>string</value> | <value>buffer</value>]</syntax> |
153 <default/> | 153 <default/> |
154 <context>location</context> | 154 <context>location</context> |
155 <context>if in location</context> | |
155 <context>limit_except</context> | 156 <context>limit_except</context> |
156 <appeared-in>0.5.2</appeared-in> | 157 <appeared-in>0.5.2</appeared-in> |
157 | 158 |
158 <para> | 159 <para> |
159 Sets an njs function as a response body filter. | 160 Sets an njs function as a response body filter. |
224 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link> | 225 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link> |
225 are not supported. | 226 are not supported. |
226 </note> | 227 </note> |
227 </para> | 228 </para> |
228 | 229 |
230 <para> | |
231 <note> | |
232 The directive can be specified inside the | |
233 <link doc="../http/ngx_http_rewrite_module.xml" id="if">if</link> block | |
234 since <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. | |
235 </note> | |
236 </para> | |
237 | |
229 </directive> | 238 </directive> |
230 | 239 |
231 | 240 |
232 <directive name="js_content"> | 241 <directive name="js_content"> |
233 <syntax><value>function</value> | <value>module.function</value></syntax> | 242 <syntax><value>function</value> | <value>module.function</value></syntax> |
234 <default/> | 243 <default/> |
235 <context>location</context> | 244 <context>location</context> |
245 <context>if in location</context> | |
236 <context>limit_except</context> | 246 <context>limit_except</context> |
237 | 247 |
238 <para> | 248 <para> |
239 Sets an njs function as a location content handler. | 249 Sets an njs function as a location content handler. |
240 Since <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>, | 250 Since <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>, |
241 a module function can be referenced. | 251 a module function can be referenced. |
252 </para> | |
253 | |
254 <para> | |
255 <note> | |
256 The directive can be specified inside the | |
257 <link doc="../http/ngx_http_rewrite_module.xml" id="if">if</link> block | |
258 since <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. | |
259 </note> | |
242 </para> | 260 </para> |
243 | 261 |
244 </directive> | 262 </directive> |
245 | 263 |
246 | 264 |
391 | 409 |
392 <directive name="js_header_filter"> | 410 <directive name="js_header_filter"> |
393 <syntax><value>function</value> | <value>module.function</value></syntax> | 411 <syntax><value>function</value> | <value>module.function</value></syntax> |
394 <default/> | 412 <default/> |
395 <context>location</context> | 413 <context>location</context> |
414 <context>if in location</context> | |
396 <context>limit_except</context> | 415 <context>limit_except</context> |
397 <appeared-in>0.5.1</appeared-in> | 416 <appeared-in>0.5.1</appeared-in> |
398 | 417 |
399 <para> | 418 <para> |
400 Sets an njs function as a response header filter. | 419 Sets an njs function as a response header filter. |
412 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link> | 431 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link> |
413 are not supported. | 432 are not supported. |
414 </note> | 433 </note> |
415 </para> | 434 </para> |
416 | 435 |
436 <para> | |
437 <note> | |
438 The directive can be specified inside the | |
439 <link doc="../http/ngx_http_rewrite_module.xml" id="if">if</link> block | |
440 since <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. | |
441 </note> | |
442 </para> | |
443 | |
417 </directive> | 444 </directive> |
418 | 445 |
419 | 446 |
420 <directive name="js_import"> | 447 <directive name="js_import"> |
421 <syntax><value>module.js</value> | | 448 <syntax><value>module.js</value> | |
422 <value>export_name from module.js</value></syntax> | 449 <value>export_name from module.js</value></syntax> |
423 <default/> | 450 <default/> |
424 <context>http</context> | 451 <context>http</context> |
452 <context>server</context> | |
453 <context>location</context> | |
425 <appeared-in>0.4.0</appeared-in> | 454 <appeared-in>0.4.0</appeared-in> |
426 | 455 |
427 <para> | 456 <para> |
428 Imports a module that implements location and variable handlers in njs. | 457 Imports a module that implements location and variable handlers in njs. |
429 The <literal>export_name</literal> is used as a namespace | 458 The <literal>export_name</literal> is used as a namespace |
441 | 470 |
442 <para> | 471 <para> |
443 Several <literal>js_import</literal> directives can be specified. | 472 Several <literal>js_import</literal> directives can be specified. |
444 </para> | 473 </para> |
445 | 474 |
475 <para> | |
476 <note> | |
477 The directive can be specified on the | |
478 <literal>server</literal> and <literal>location</literal> level | |
479 since <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. | |
480 </note> | |
481 </para> | |
482 | |
446 </directive> | 483 </directive> |
447 | 484 |
448 | 485 |
449 <directive name="js_include"> | 486 <directive name="js_include"> |
450 <syntax><value>file</value></syntax> | 487 <syntax><value>file</value></syntax> |
481 <directive name="js_path"> | 518 <directive name="js_path"> |
482 <syntax> | 519 <syntax> |
483 <value>path</value></syntax> | 520 <value>path</value></syntax> |
484 <default/> | 521 <default/> |
485 <context>http</context> | 522 <context>http</context> |
523 <context>server</context> | |
524 <context>location</context> | |
486 <appeared-in>0.3.0</appeared-in> | 525 <appeared-in>0.3.0</appeared-in> |
487 | 526 |
488 <para> | 527 <para> |
489 Sets an additional path for njs modules. | 528 Sets an additional path for njs modules. |
529 </para> | |
530 | |
531 <para> | |
532 <note> | |
533 The directive can be specified on the | |
534 <literal>server</literal> and <literal>location</literal> level | |
535 since <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. | |
536 </note> | |
490 </para> | 537 </para> |
491 | 538 |
492 </directive> | 539 </directive> |
493 | 540 |
494 | 541 |
496 <syntax> | 543 <syntax> |
497 <value>$variable</value> <value>function</value> | | 544 <value>$variable</value> <value>function</value> | |
498 <value>module.function</value></syntax> | 545 <value>module.function</value></syntax> |
499 <default/> | 546 <default/> |
500 <context>http</context> | 547 <context>http</context> |
548 <context>server</context> | |
549 <context>location</context> | |
501 | 550 |
502 <para> | 551 <para> |
503 Sets an njs <literal>function</literal> | 552 Sets an njs <literal>function</literal> |
504 for the specified <literal>variable</literal>. | 553 for the specified <literal>variable</literal>. |
505 Since <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>, | 554 Since <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>, |
532 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link> | 581 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link> |
533 are not supported. | 582 are not supported. |
534 </note> | 583 </note> |
535 </para> | 584 </para> |
536 | 585 |
586 <para> | |
587 <note> | |
588 The directive can be specified on the | |
589 <literal>server</literal> and <literal>location</literal> level | |
590 since <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. | |
591 </note> | |
592 </para> | |
593 | |
537 </directive> | 594 </directive> |
538 | 595 |
539 | 596 |
540 <directive name="js_var"> | 597 <directive name="js_var"> |
541 <syntax><value>$variable</value> [<value>value</value>]</syntax> | 598 <syntax><value>$variable</value> [<value>value</value>]</syntax> |
542 <default/> | 599 <default/> |
543 <context>http</context> | 600 <context>http</context> |
601 <context>server</context> | |
602 <context>location</context> | |
544 <appeared-in>0.5.3</appeared-in> | 603 <appeared-in>0.5.3</appeared-in> |
545 | 604 |
546 <para> | 605 <para> |
547 Declares | 606 Declares |
548 a <link doc="../njs/reference.xml" id="r_variables">writable</link> | 607 a <link doc="../njs/reference.xml" id="r_variables">writable</link> |
551 The variable is not overwritten after a redirect | 610 The variable is not overwritten after a redirect |
552 unlike variables created with the | 611 unlike variables created with the |
553 <link doc="ngx_http_rewrite_module.xml" id="set"/> directive. | 612 <link doc="ngx_http_rewrite_module.xml" id="set"/> directive. |
554 </para> | 613 </para> |
555 | 614 |
615 <para> | |
616 <note> | |
617 The directive can be specified on the | |
618 <literal>server</literal> and <literal>location</literal> level | |
619 since <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. | |
620 </note> | |
621 </para> | |
622 | |
556 </directive> | 623 </directive> |
557 | 624 |
558 </section> | 625 </section> |
559 | 626 |
560 | 627 |