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
Next revisionBoth sides next revision
custom:javascript [2018/06/17 14:22] – Replaced broken link for Mozilla's JavaScript engine. uatu13custom:javascript [2018/12/27 19:47] – Added link to JS Libraries index digital man
Line 72: Line 72:
 Synchronet has its own constantly evolving JavaScript object model (containing classes, objects, methods, and properties), not to be confused with the Document Object Model (DOM) used in web browsers. In order to fully understand the capabilities of JavaScript modules in Synchronet, you must familiarize yourself with [[http://developer.mozilla.org/docs/Core_JavaScript_1.5_Reference|Core JavaScript]] as well as the [[http://synchro.net/docs/jsobjs.html|Synchronet JavaScript Object Model]]. Synchronet has its own constantly evolving JavaScript object model (containing classes, objects, methods, and properties), not to be confused with the Document Object Model (DOM) used in web browsers. In order to fully understand the capabilities of JavaScript modules in Synchronet, you must familiarize yourself with [[http://developer.mozilla.org/docs/Core_JavaScript_1.5_Reference|Core JavaScript]] as well as the [[http://synchro.net/docs/jsobjs.html|Synchronet JavaScript Object Model]].
  
-===== load ===== +==== load ==== 
  
 The Synchronet JavaScript object model includes a global method: ''load()'' (a closely-related ''require()'' method was added in v3.17). The Synchronet JavaScript object model includes a global method: ''load()'' (a closely-related ''require()'' method was added in v3.17).
Line 116: Line 116:
  
 This usage expressly places all items created by the loaded script into the scope of the passed variable (in this case, a newly created empty //Object//, just for this purpose). This means there should be no naming conflicts between the parent script and the loaded script (e.g. they may have methods or variables defined with the **same name** and there will be [[https://www.youtube.com/watch?v=2CifYWxJXaI|no confrict]]). This usage expressly places all items created by the loaded script into the scope of the passed variable (in this case, a newly created empty //Object//, just for this purpose). This means there should be no naming conflicts between the parent script and the loaded script (e.g. they may have methods or variables defined with the **same name** and there will be [[https://www.youtube.com/watch?v=2CifYWxJXaI|no confrict]]).
 +
 +==== Output ==== 
 +There are many different text output methods supported by the Synchronet JavaScript Object Model and knowing which method (function) to use in what situation can be confusing. The following table should help:
 +
 +^ Method          ^ BBS((Terminal Server)) ^ JSexec ^ Prints newline ^ Expands/Decodes    ^ Multiple Values((as function arguments)) ^ Notes ^
 +| ''write()''     | Yes                    | Yes    | No           | Telnet-IAC, Ctrl-A | Yes                | If user not online, same as ''log(LOG_INFO, ...)'' |
 +| ''write_raw()'' | Yes                    | No     | No           | Telnet-IAC         | Yes                | Value may contain NULs, no charset translation |
 +| ''writeln()''   | Yes                    | Yes    | Yes          | Telnet-IAC, Ctrl-A | Yes                | aka ''print()'' |
 +| ''printf()''    | Yes                    | Yes    | No           | Telnet-IAC, Ctrl-A | Yes((using C printf format syntax))  | ala C ''printf()''  |
 +| ''alert()''     | Yes                    | Yes    | Yes          | Telnet-IAC, Ctrl-A | No                 | If user not online, same as ''log(LOG_WARNING, ...)'' |
 +| ''log()''             | Yes              | Yes    | N/A          |                    | Yes((following the log-level argument)) | Displayed/logged on the server only |
 +| ''console.print()''   | Yes              | No     | No           | Telnet-IAC, Ctrl-A | Yes | |
 +| ''console.write()''   | Yes              | No     | No           | Telnet-IAC         | Yes | |
 +| ''console.writeln()'' | Yes              | No     | Yes          | Telnet-IAC         | Yes | |
 +| ''console.putmsg()''  | Yes              | No     | No           | Telnet-IAC, Ctrl-A, @-Codes | No        |       |
 +| ''console.center()''  | Yes              | No     | Yes          | Telnet-IAC, Ctrl-A | No | Text centered on screen |
 +| ''console.mnemonics()'' | Yes            | No     | No           | Telnet-IAC, Ctrl-A, @-Codes, ~ | No | Hotkey highlights |
 +| ''console.putbyte()'' | Yes              | No     | No           | Telnet-IAC         | No | No charset translation |
 +| ''client.socket.send()'' | Yes           | No     | No                              | No | Avoid using |
 +
 ===== See Also ===== ===== See Also =====
   * [[http://synchro.net/docs/jsobjs.html|Synchronet JavaScript Object Model]]   * [[http://synchro.net/docs/jsobjs.html|Synchronet JavaScript Object Model]]
-  * [[:util:jsexec]] +  * [[http://nix.synchro.net/jsobjs.html|Synchronet JavaScript Object Model (preliminary for v3.17a)]] 
-  * [[:util:baja]] +  * [[:util:JSexec]] 
 +  * [[:util:Baja]]  
 +  * [[:custom:javascript:lib:|JavaScript Libraries]]
   * [[:custom:index|Customization]]   * [[:custom:index|Customization]]
  
 {{tag>javascript}} {{tag>javascript}}