[ACCEPTED]-Building Standalone Applications in JavaScript-browser
I've written several application in JS including 2 a spreadsheet.
Upside:
- great language
- short code-run-review cycle
- DOM manipulation is great for UI design
- clients on every computer (and phone)
Downside:
- differences between browsers (especially IE)
- code base scalability (with no intrinsic support for namespaces and classes)
- no good debuggers (especially, again, for IE)
- performance (even though great progress has been made with FireFox and Safari)
- You need to write some server code as well.
Bottom line: Go 1 for it. I did.
Another option for developing simple desktop 9 like applications or games in JavaScript 8 is Adobe AIR. You can build your app code in either 7 HTML + JavaScript or using Flash/Flex or 6 a combination of both. It has the advantage 5 of being cross-platform (actually cross-platform, Linux, OS 4 X, and Windows. Not just Windows and OS 3 X).
Heck, it may be the only time in your 2 career as a developer that you can write 1 a web page and ONLY target ONE browser.
SproutCore is a wholly JavaScript-hosted application 18 framework, borrowing concepts particularly 17 from Cocoa (such as KVO) and Ruby on Rails 16 (such as using a CLI generator for your 15 models, views and controllers). It includes 14 Prototype, but builds plenty of stuff such 13 as sophisticated controls on top of that. Its 12 Photos demo is arguably impressive (especially 11 in Safari 3.1).
Greg already pointed you 10 to Gears; in addition, HTML 5 will come 9 with a standardized means of local storage. Safari 8 3.1 ships with an implementation where you 7 have a per-site SQLite database with user-settable 6 size maximums, as well as a built-in database browser with SQL querying. Unfortunately, it 5 will be a long time until we can expect 4 broad browser support. Until then, Gears 3 is indeed an alternative (but not for Safari… yet!). For 2 simpler storage, there is of course always 1 cookies.
The downside to this would be that you are 14 at the mercy of them having js enabled. I'm 13 not sure that this is a big deal now. Virtually 12 every browser supports js and has it enabled 11 by default.
Of course the other downside 10 would be performance. You are again at the 9 mercy of the client handling all the intensive 8 work. This also may not be that big of a 7 deal, and would be dependent on the type 6 of app you are building.
I've never used 5 Gears, but it looks like it is worth a shot. The 4 backup plan would be to run some server 3 side script through ajax that dumps your 2 data somewhere.
Not completely client side, but 1 oh well.
Nihilogic (not my site) does a lot of stuff with 4 Javascript. They even have several games that 3 they've made in Javascript.
I've also seen 2 a neat roguelike game made in Javascript. Unfortunately, I 1 can't remember what it was called...
If you want to write a standalone JavaScript 6 application, look at XULrunner. It's what Firefox 5 is built on, but it is also built so that 4 you can distribute it as an application 3 runtime. You will write some of the interface 2 in JavaScript and use JavaScript for your 1 code.
Gears might provide the client-side persistent 5 data storage you need. There isn't a terribly 4 good way of not exposing your source code, though. You 3 could obfuscate it but that only helps somewhat.
I've 2 done simple apps like this for stuff like 1 a Sudoku solver.
You might run into performance issues given 6 that you're completely at the mercy of the 5 client's Javascript interpreter. Gears would 4 be a nice way of data storage, but I don't 3 think it has penetrated the market that 2 much. You could just use cookies if you're 1 not fussy about that kind of thing.
I'm with ScottKoon here, Adobe AIR is great. I've 10 really only made one really nice (imho) widget 9 thus far, but I did so using jQuery and 8 Prototype.js, which floored in such wonderful 7 ways because I didn't have to learn a whole 6 new event model. Adobe AIR is really sweet, the 5 memory foot print isn't too bad, upgrading 4 to a new version is built into AIR so it's 3 almost automatic, and best of all it's cross-platform...they 2 even have an alpha-version for Linux, but 1 it works pretty well already on my Eee.
In regard to saving files from a javascript application:
I am really excited about the possibilities 8 of client-side applications. Flash 10 introduced 7 the ability to create files for save right 6 in the browser. I thought it was super cool, so 5 I built a javascript+flash component to 4 wrap the saving feature. Right now it only 3 works for creating text based files (vcard, ical, xml, html, css, etc.)
I 2 am looking to add support for non-text files 1 soon, but this is a start.
My RSS feeds have served me well- I found 1 that Javascript roguelike!
It's called The Tombs of Asciiroth.
Given that you're going to be writing some 11 server code anyway, it makes sense to keep 10 storage on the server for a lot of domains 9 (address books, poker scores, gui configuration, etc.,.) For 8 anything the size of what you'll get in 7 Webkit or Gears, you can probably also keep 6 it on your server.
The advantage of keeping 5 it on your server is two-fold:
- You can integrate it fairly simply as a Model layer in a typical MVC framework, and,
- Users get a consistent view without being tied to their browser/PC, or in a less-than-ideal environment (Internet Cafés).
The server 4 code for handling this can also be fairly 3 trivial, particularly if it's written with 2 this task in mind, so it's not a huge cognitive 1 burden.
Go with qooxdoo. They recently realsed 1.0, although 15 most users of it say it was ripe for 1.0 14 at least two versions ago.
I compared qooxdoo 13 with YUI and ext, and I think qooxdoo is 12 the way to go for programmers - YUI isn't 11 that polished as qooxdoo, from a programmer's 10 point of view and ext has a not so friendly 9 licensing model.
A few of the strong points 8 (for me) of qooxdoo are:
- extremely clean code
- the nicest OO programming model I've seen among Javascript frameworks
- an extremely rich UI widget library
It also features 7 a test runner for unit tests, an API doc 6 generator and reader, a logging facility, and 5 several useful features for debugging, grouped 4 under something called Inspector.
The only 3 downside is that there aren't readymade 2 themes (something like skins) for qooxdoo. But 1 creating your own theme is quite easy.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.