# HG changeset patch # User Yaroslav Zhuravlev # Date 1616178274 0 # Node ID 45214e5316cd8fdb067a022e66b2ee984b93f716 # Parent 5282d6d3d8491ed3699fcd65c01775cc956b044c Improved description of js_set. diff --git a/xml/en/docs/http/ngx_http_js_module.xml b/xml/en/docs/http/ngx_http_js_module.xml --- a/xml/en/docs/http/ngx_http_js_module.xml +++ b/xml/en/docs/http/ngx_http_js_module.xml @@ -9,7 +9,7 @@ + rev="27">
@@ -298,11 +298,27 @@ Sets an additional path for njs modules. http -Sets an njs function for the specified variable. +Sets an njs function +for the specified variable. Since 0.4.0, a module function can be referenced. + +The function is called when +the variable is referenced for the first time for a given request. +The exact moment depends on a +phase +at which the variable is referenced. +This can be used to perform some logic +not related to variable evaluation. +For example, if the variable is referenced only in the + directive, +its handler will not be executed until the log phase. +This handler can be used to do some cleanup +right before the request is freed. + +
diff --git a/xml/en/docs/stream/ngx_stream_js_module.xml b/xml/en/docs/stream/ngx_stream_js_module.xml --- a/xml/en/docs/stream/ngx_stream_js_module.xml +++ b/xml/en/docs/stream/ngx_stream_js_module.xml @@ -9,7 +9,7 @@ + rev="25">
@@ -259,11 +259,27 @@ a module function can be referenced. stream -Sets an njs function for the specified variable. +Sets an njs function +for the specified variable. Since 0.4.0, a module function can be referenced. + +The function is called when +the variable is referenced for the first time for a given request. +The exact moment depends on a +phase +at which the variable is referenced. +This can be used to perform some logic +not related to variable evaluation. +For example, if the variable is referenced only in the + directive, +its handler will not be executed until the log phase. +This handler can be used to do some cleanup +right before the request is freed. + +
diff --git a/xml/ru/docs/http/ngx_http_js_module.xml b/xml/ru/docs/http/ngx_http_js_module.xml --- a/xml/ru/docs/http/ngx_http_js_module.xml +++ b/xml/ru/docs/http/ngx_http_js_module.xml @@ -9,7 +9,7 @@ + rev="27">
@@ -299,11 +299,27 @@ function version(r) { http -Задаёт функцию njs для указанной переменной. +Задаёт функцию njs +для указанной переменной. Начиная с 0.4.0 можно ссылаться на функцию модуля. + +Функция вызывается в момент +первого обращения к переменной для данного запроса. +Точный момент вызова функции зависит от +фазы, +в которой происходит обращение к переменной. +Это можно использовать для реализации дополнительной логики, +не относящейся к вычислению переменной. +Например, если переменная указана +в директиве , +то её обработчик не будет выполняться до фазы записи в лог. +Этот обработчик также может использоваться для выполнения процедур +непосредственно перед освобождением запроса. + +
diff --git a/xml/ru/docs/stream/ngx_stream_js_module.xml b/xml/ru/docs/stream/ngx_stream_js_module.xml --- a/xml/ru/docs/stream/ngx_stream_js_module.xml +++ b/xml/ru/docs/stream/ngx_stream_js_module.xml @@ -9,7 +9,7 @@ + rev="25">
@@ -260,11 +260,27 @@ function address(s) { stream -Задаёт функцию njs для указанной переменной. +Задаёт функцию njs +для указанной переменной. Начиная с 0.4.0 можно ссылаться на функцию модуля. + +Функция вызывается в момент +первого обращения к переменной для данного запроса. +Точный момент вызова функции зависит от +фазы, +в которой происходит обращение к переменной. +Это можно использовать для реализации дополнительной логики, +не относящейся к вычислению переменной. +Например, если переменная указана +в директиве , +то её обработчик не будет выполняться до фазы записи в лог. +Этот обработчик также может использоваться для выполнения процедур +непосредственно перед освобождением запроса. + +