Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Javascript for desktop apps?
13 points by ekiru on July 27, 2009 | hide | past | favorite | 24 comments
I've been wanting to learn Javascript lately, and I've become curious as to how Javascript/ECMAscript fares as a language for writing software to be ran on the desktop. Are there any ECMAscript implementations with good FFIs? Are the good libraries/bindings for writing GUI desktop apps in ECMAscript? Is it possible to get acceptable performance(comparable to Python or at least Ruby, perhaps?) from ECMAscript?

If you were writing a desktop app in ECMAscript, which implementation would you use? Would you actually consider using ECMAscript to write a desktop app?

Are there any good books or other resources you would recommend on writing desktop apps in ECMAscript?



why not simply embed a web server and connect to the localhost ? That makes your application internet ready as well when the time is right as well as giving the user to connect to your application from other pcs on the same lan.

I've built a music management system along these lines and it works quite well. The internet ready part of it causes all kinds of unintended but useful side effects, stuff that I never thought of when building it.


Not sure why you were downvoted. I don't think the idea so "out there". Apps embed their own sql servers, too, why not a web server.

I think it would be nice to have a launcher that launches both the client and the server then.


If you were referring to Firefox / sqlite3.. I wouldnt consider sqlite3 a server at all. Nonetheless, I agree with what you are saying


Strictly speaking it's not a server, true.


sorry if i was being nitpicky


This is an excellent approach, and in my view will be common in the future. It can also elegantly solve the problem of offline access, with the local web server syncing with the remote server in the background.


On the windows desktop platform you can use JScript and the .NET Framework to write just about any desktop application you can imagine.

This language (which is a good implementation of up-to-date ECMAScript) is somewhat light on texts however. There is a SAMS book by Justin Rogers which does cover the basics.

You might be better off looking at something like Adobe AIR which is an excellent approach to making a web style application run like a desktop application - well worth exploring and could be a good platform for developing portable (and applicable) JavaScript skills.


Yep, I'd suggest giving Adobe Air a spin. With some plain HTML, CSS and JavaScript you can create a decent (enough) cross-platform application. If you need an idea to get started, have a look at http://github.com/roam/morse/tree/master.


Actionscript 3 is very close to javascript. The Adobe Air framework allows you to deploy desktop apps.

Depending on what you're trying to do you might want to try XUL Runner https://developer.mozilla.org/en/XULRunner . It will allow you build an html/js app that can run as a desktop app.


I love Javascript, but I think people who want to develop server-side or desktop apps with it might be better served by Lua. Lua has functions as first-class values like Javascript does, which allows you to approach problems similarly in both languages.

Lua has also already been in use as a server-side and desktop language for some time, and while the available toolkits pale in comparison to what's available, say, for Java, Python or Ruby, there are still more options than there are for Javascript right now. Lua is very fast; for most benchmarks at http://shootout.alioth.debian.org it's the fastest interpreted language.

Sorry this is doesn't exactly answer the question you're asking but I thought it might be worth mentioning as another possibility to consider.


Check out the Titanium Developer platform. It's exactly what you want. http://www.appcelerator.com


You could try Rhino:

https://developer.mozilla.org/en/Rhino_documentation

Steve Yegge suggests it's the next big language.


This is very convenient now that Java (as of 1.6) has JavaScript/Rhino built in as an implementation of the Scripting API: http://snipplr.com/view/17501/javascript-swing-application/

Execution is as simple as 'jrunscript app.js'.


The KDE desktop shell, Plasma, has js bindings so you can develop plasmoids (applets) with javascript.

http://techbase.kde.org/Development/Tutorials/Plasma/JavaScr...


Sorry, forgot: This stuff is quite new so you might find some stuff missing from the bindings, but it's growing speedily. For the curious, it uses QScript.


Performance wise, consider that people have been using scripting languages since the 90'ies (Tcl/Tk) with perfectly acceptable results, so that's not really your problem. The issue is going to be finding how to do a GUI.


http://live.gnome.org/GnomeShell

Written mostly in javascript, with dynamically-generated bindings to GTK+ et al.


Interesting, though ultimately I would prefer to spend resources on cross platform stuff.


You might not want to hack on that project, but in all cases you have to install a runtime, be it a web server or xulrunner or whatever.

GTK+ can be a pita to install, but it's as cross-platform as anything else.


Then I misunderstood, I thought it was a Gnome only project. GTK would be OK.


You could use XUL for the GUI. The German car rental company Sixt did that in 2005 for their corporate apps. I don't know what became of it, though.


Adobe Air is a possibility


Not just a possibility, its an emerging method of taking the web technologies to the desktop. You can mix AS3 and HTML/JS for a very clean, and fast implementation of typical desktop UI features. Honestly, AIR is perhaps the easiest way to package these sorts of things.


You could use the LGPL Qt4.5 (cross-platform), which includes an ECMAScript scripting engine (with debugger).




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: