Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
custom:javascript:lib:index [2018/12/27 20:00] – List the JS lib child documents (just one for now) 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:
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