Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
config:modopts.ini [2021/05/25 19:15] – [Format] Mention that you (sysop) can add sections/keys as needed digital manconfig:modopts.ini [2023/10/19 12:27] (current) – Don't copy/paste defaults into your modopts.ini file digital man
Line 11: Line 11:
 ===== Use ===== ===== Use =====
 JavaScript module authors use the ''modopts.ini'' file by adding a single line to their ''.js'' file: JavaScript module authors use the ''modopts.ini'' file by adding a single line to their ''.js'' file:
-  options=load(new Object, "modopts.js", "mymodule");+<code javascript> 
 +options=load(new Object, "modopts.js", "mymodule"); 
 +</code>
 where "mymodule" is replaced with the JavaScript's module name (typically the module's main script filename, without the ''.js'' extension). where "mymodule" is replaced with the JavaScript's module name (typically the module's main script filename, without the ''.js'' extension).
  
Line 17: Line 19:
  
 Example ''modopts.ini'' section: Example ''modopts.ini'' section:
-<file>+<code ini>
 [mymodule] [mymodule]
 enable_cool_feature=true enable_cool_feature=true
-</file>+</code>
  
 Options that need literal values should use a ':' like this: Options that need literal values should use a ':' like this:
-<file>+<code ini>
 [xtrn_sec] [xtrn_sec]
 which: \r\n\1-\1gWhich or \1h~Q\1n\1guit: \1h which: \r\n\1-\1gWhich or \1h~Q\1n\1guit: \1h
-</file>+</code>
  
 Example module use of modopts in a fictional example module named "mymodule" (e.g. ''mymodule.js''): Example module use of modopts in a fictional example module named "mymodule" (e.g. ''mymodule.js''):
-<code>+<code javascript>
 options=load(new Object, "modopts.js", "mymodule"); options=load(new Object, "modopts.js", "mymodule");
  
Line 35: Line 37:
    do_cool_feature();    do_cool_feature();
 </code> </code>
 +
 +===== Defaults =====
 +Synchronet Modules should have optimal default values for any options that they make available via the ''modopts.ini'' file. Unless you have a good reason to do so, it is **not** recommended that you copy default key/value pairs into your ''modopts.ini'' file. Module defaults may change later (in the module script) and automatically using any //new// default option value is most likely what you and the module-script author want/expect to happen.
  
 ===== See Also ===== ===== See Also =====
Line 51: Line 56:
   * [[module:nodelist|Node List]]   * [[module:nodelist|Node List]]
  
-{{tag>javascript modules}}+ 
 +{{tag>configuration javascript module general_config ini}}