On Wed, Oct 31, 2012 at 10:44 AM, Arunoda Susiripala
<
arunoda.s...@gmail.com> wrote:
> Yes. I browserify does it. The video show's that. But what I suggest is it
> will be cooler, we can bundle all the Node Core (if possible) into a single
> JS file which using Chrome new APIS.
It's not possible to take the JS in node as-is and put it in a
browser. Node consumes custom libuv C++ bindings that were designed
for node, not browser dom APIs. This would be a new implementation of
the node APIs on top of what the browser provides.
>
> What are the primitives which chrome is not possible to do? I have not much
> experience in Node Core. And I'm referring to chrome (but not other browser)
> which has native APIs for Socket API and so many others.
Go through the node API, it's not that big.
http://nodejs.org/api/
And for each item, find a corresponding browser API that provides the
same abilities. Some problems I can see right away are:
fs.*. I'm not aware of any browser API that lets web pages read and
write a user's hard-drive
net.* While there are tcp clients coming to browsers, I have yet to
see any standard that allows binding to a port and listening on it.
child_process.* I'm pretty sure the browser doesn't allow a web page
to create arbitrary processes and execute them
...
If you're ok with requiring your users to use a specefic browser, why
not just use node-webkit or appjs and provide the webkit runtime for
them with all of node embedded already?