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
Next revisionBoth sides next revision
custom:javascript:lib:index [2018/12/27 19:22] – Fill out the library usage examples more, fixed some typos digital mancustom:javascript:lib:index [2019/01/11 19:07] – [Require vs. Load] Added comment about exit() use in libraries digital man
Line 10: Line 10:
 The ''require()'' function (added in Synchronet v3.17) is identical in usage to ''load()'' with the exception that it will //conditionally// load and execute the script only if the property name argument (specified just after the filename argument) is not already defined in the target scope. This prevents redundant loading/compilation/execution of libraries shared among multiple modules. For large libraries or commonly used libraries, consider using ''require()'' instead of ''load()'' to enhance performance and avoid the possible erroneous redefinition of ''const'' variables during subsequent ''load()'' operations of the same library. The ''require()'' function (added in Synchronet v3.17) is identical in usage to ''load()'' with the exception that it will //conditionally// load and execute the script only if the property name argument (specified just after the filename argument) is not already defined in the target scope. This prevents redundant loading/compilation/execution of libraries shared among multiple modules. For large libraries or commonly used libraries, consider using ''require()'' instead of ''load()'' to enhance performance and avoid the possible erroneous redefinition of ''const'' variables during subsequent ''load()'' operations of the same library.
  
 +===== exit ===== 
 +Libraries should **not** (normally) call the global ''exit()'' method or else the calling script(s) will also terminate, possibly unexpectedly.
 ===== Styles ===== ===== Styles =====
 There are 3 main //styles// of JavaScript libraries included with Synchronet: There are 3 main //styles// of JavaScript libraries included with Synchronet:
Line 36: Line 38:
   someLib.property = true;   someLib.property = true;
   someLib.do_something();   someLib.do_something();
 +  
 +==== Index ====
 +Articles documenting the usage of specific JavaScript Libraries are listed here:
 +{{indexmenu>.}}
  
 ===== See Also ===== ===== See Also =====
   * [[:custom:javascript:|JavaScript]]   * [[:custom:javascript:|JavaScript]]
 +  * [[http://cvs.synchro.net/cgi-bin/viewcvs.cgi/exec/load/|load Directory contents from Synchronet CVS]]
  
 {{tag>javascript}} {{tag>javascript}}
  
custom/javascript/lib/index.txt · Last modified: 2024/03/11 21:24 by digital man
Back to top
CC Attribution 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0