
Ask HN: Javascript for desktop apps? - ekiru
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?<p>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?<p>Are there any good books or other resources you would recommend on writing desktop apps in ECMAscript?
======
jacquesm
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.

~~~
Tichy
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.

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

~~~
Tichy
Strictly speaking it's not a server, true.

~~~
mdg
sorry if i was being nitpicky

------
bdfh42
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.

~~~
roam
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>.

------
dantheman
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.

------
compay
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.

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

------
scscsc
You could try Rhino:

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

Steve Yegge suggests it's the next big language.

~~~
mcculley
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'.

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

[http://techbase.kde.org/Development/Tutorials/Plasma/JavaScr...](http://techbase.kde.org/Development/Tutorials/Plasma/JavaScript/GettingStarted)

~~~
makmanalp
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.

------
davidw
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.

------
wingo
<http://live.gnome.org/GnomeShell>

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

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

~~~
wingo
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.

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

------
limmeau
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.

------
anc2020
Adobe Air is a possibility

~~~
abyssknight
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.

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

