Imagine ripping off the visual rendering part of Firefox and replacing it with a hook to Apache instead – roughly speaking that’s what Jaxer is.
Jaxer is a strange new hybrid application coming from the folks at Aptana (the makers of the quite-excellent web IDE). Literally, they took the Mozilla platform (which powers Firefox, Camino, etc.) and built a stateful platform on top of it.
runat="both"declaration, additionally, states that the script block should be executed on both the client and the server (in this demo we’re using jQuery in both places).
Jaxer.File– These set of methods are part of the Jaxer API. It’s important to note that these functions can only be run on the server-side, thus they should only be called in a server-capable script block. The methods do what you would expect them to: They allow you to do simple interactions with text files.
save.proxy = true;– The save() function must exist on the server-side (since it contains calls to server-side functionality) however we want to be able to call it from the client-side whenever the user hits the submit button to save their textarea changes. We can do this by making it a proxy function (adding an extra proxy property to the function). This actually creates a stub function on the client-side, to allow the code to continue working as it would expect, while obscuring the actual functionality behind an Ajax request. It’s all completely seamless and works as you would expect it to, which is impressive. You can also make functions proxy functions by using a
runat="proxy"on a script block.
onserverload="load()"– This attribute gives a simple mechanism for running a piece of server-side functionality on DOM ready. In this case we’re loading the contents of the saved text file and injecting it into the textarea, using jQuery.
Disclaimer: I’m a proud member of Aptana’s advisory board. I’ve been greatly impressed with their work and I’m glad they asked me to join them.