NodeJS is based on the v8 JavaScript engine - thus, it is ment to be a standalone app…so embedding it is not a goal you can reach. NodeJS’ core logic relies on being the „one and only“ part of the app - initializing an uv event loop and v8 instance for the process. There is no such way of extending an existing v8 instance with the NodeJS environment (too bad! It’s a shame, really…).
But, there are alternatives: - Desktop can have nw.js: http://nwjs.io/ - Mobile could use https://github.com/paddybyers/anode There is currently no library or such that maps all NodeJS features into a library, that you can simply use. The main problem I see is that NodeJS requires a uv loop which blocks the currently running thread. To sum up what code NodeJS does using v8; // Make the JS context Isolate* isolate = new Isolate(); context* ctx = new Context(isolate); // Add NodeJS APIs node::prepare_environment(ctx); // Start, run and when no events are left, end the loop. uv_loop_t *loop = malloc(sizeof(uv_loop_t)); uv_loop_init(loop); uv_run(loop, UV_RUN_DEFAULT); uv_loop_close(loop); free(loop); The fact that the current thread is blocked may be bad for most applications. Therefore, I can suggest you to actually look into WebViews. These are usually UI classes - different on each platform though… - that allow you to open a website, and in most case, modify the JavaScript environment. I’d suggest you to add common APIs yourself. > Am 15.02.2015 um 19:17 schrieb Daniel Zduniak <[email protected]>: > > I'm interested in developing a solution that would allow to create desktop > apps with Node.js. > > I believe requiring user to install whole Node.js platform would seem to be > too cumbersome and just unnecessary since the user wouldn't really need full > developer environment for his needs - he only needs to be able to run the > app. It would be especially undesired on mobile, where installing Node.js is > simply difficult or maybe even impossible... > > So the solution I'm proposing would be to use special launcher with embedded > Node.js interpreter that would then run proper Node.js app... > > Is something like this currently possible? If yes could you provide me with > some hints? > > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/704b0e91-5d5b-4155-8b1c-09f2ded348a2%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/D9590BDE-A53C-4DF2-80D7-10AC2CAF44EF%40googlemail.com. For more options, visit https://groups.google.com/d/optout.
