manual:config:items:preprocessing:javascript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
manual:config:items:preprocessing:javascript [2021/02/19 08:06]
martins-v sha256 hash function (ZBXNEXT-6443)
manual:config:items:preprocessing:javascript [2021/03/17 12:37] (current)
martins-v moving global javascript function info (ZBX-18592)
Line 42: Line 42:
  
 JavaScript preprocessing is implemented with Duktape (https://​duktape.org/​) JavaScript engine. JavaScript preprocessing is implemented with Duktape (https://​duktape.org/​) JavaScript engine.
 +
 +See also: [[:​manual/​config/​items/​preprocessing/​javascript/​javascript_objects|Additional JavaScript objects and global functions]]
  
 == Using macros in scripts == == Using macros in scripts ==
Line 54: Line 56:
 return (!isNaN(threshold) && value > threshold) ? threshold : value; return (!isNaN(threshold) && value > threshold) ? threshold : value;
 </​code>​ </​code>​
- 
- 
-=== Global JavaScript functions === 
- 
-Additional global JavaScript functions have been implemented with Duktape: 
- 
-  * btoa(string) - encodes string to base64 string 
-  * atob(base64_string) - decodes base64 string 
- 
-<code java> 
-try { 
-    b64 = btoa("​utf8 string"​);​ 
-    utf8 = atob(b64); 
- 
-catch (error) { 
-    return {'​error.name'​ : error.name, '​error.message'​ : error.message} 
-} 
-</​code>​ 
- 
-  * md5(string) - calculates the MD5 hash of a string 
-  * sha256(string) - calculates the SHA256 hash of a string 
- 
-See also: [[:​manual/​config/​items/​preprocessing/​javascript/​javascript_objects|Additional JavaScript objects]]