Table of Contents
Nodejs compatibility
HopScript fully supports the Nodejs module system and the Nodejs asynchronous programming model (i.e., the asynchronous event loop).
Supported modules
Hop.js supports the following Node.js modules:
- Buffer
- Child Processes
- Cluster
- Console
- Crypto
- DNS
- Domain
- Events
- File System
- Globals
- HTTP
- HTTPS
- Modules
- Net
- OS
- Path
- PROCESS
- Punycode
- Query Strings
- Stream
- String Decoder
- Timers
- TLS/SSL
- TTY
- UDP/Datagram
- URL
- Utilities
- VM
Notable differences
The default behaviour of Hop.js is to launch an HTTP server. To mimic
Node.js, use the --no-server
option to disable the launch of the
Hop.js built-in server, and automatically terminate the process when
all events are processed.
Hop.js eval
function does not access the lexical scope surrounding
the eval
call. For Example:
function foo() {
var x = false;
return( eval( 'x' ));
}
console.log( foo() );
foo()
would return false
with Node.js, and true
with Hop.js.