Error message

Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in require_once() (line 915 of /var/www/

The lobrow method of using Node.js modules in the client side (browsers)

Node.js is a "server side javascript" platform for doing javascript software development outside the browser.  It's cool to bring this language to new places so it can be applied to problems other than web pages in browsers.  However as I noted a few days ago, there's a long-standing dream of using the same programming language for both client and server software development.  (see and

Over the weekend a blog post popped up discussing a prototype, named lobrow, implementing an implementation method for using Node.js modules in a browser.  While Node.js modules are written in JavaScript the API and structure are somewhat different than what gets used in browsers.

The basic usage is:

One thing leaps right out - that in browsers loading javascript (the require function) has to be asynchronous, whereas in Node.js the require function is synchronous.  That is, when Node executes the require statement the program can immediately use that module.  That's not how browser things work.  It means running Node.js code in a browser has to somehow support asynchronous require statements.

Another issue that isn't touched on by the post is other API differences.  There's a slew of core modules and add-on modules for Node that don't exist in a browser environment.  It means that to directly use "any" Node.js module in the browser means implementing some kind of compatibility layer of the core Node.js modules.  Otherwise for Node.js modules means limiting those modules to an API set which can be supported in the browser.

Related work: