Monday, February 26, 2007

Dojo Offline Demo and Release

Brad Neuberg keeps sprinting with his offline work for Dojo. He has just released a demo of an offline aware editor, and a release of the code itself:



We’ve finished the JavaScript layer of Dojo Offline. Dojo Offline consists of two major pieces: a JavaScript API that is included with a web application, and which helps with syncing, on/offline status notification, caching of data and resources, etc.; and a local small web proxy download that is cross-platform and cross-browser and which is web application independent. The JavaScript API is now finished, and can actually be used even though we have not finished the local web proxy yet. This is done by having the JavaScript layer be able to use the browser’s native cache if no offline cache is available. This means you can start playing with Dojo Offline right now, with the download link included in this blog post below. Note that using the browser cache instead of the web proxy is only suitable for prototyping and should not be deployed on production applications; it will work with varying degrees of success on Internet Explorer and Firefox, but not consistently on Safari. Higher levels of reliability will only come when we deliver the local web proxy component.


To start using Dojo Offline now in conjunction with the browser cache, you must have the following in your JavaScript code: dojo.off.requireOfflineCache = false. You must also turn on HTTP caching headers on your web server; how to turn on these HTTP headers and which ones to turn on are explained in the Dojo Storage FAQ. See the Moxie code links below for more examples of how to use the API. Note that the Dojo Offline JavaScript API has changed, especially for syncing, since our API blog post about a month ago and has become much simpler — see the Moxie source for details.


The demo of Moxie shown in the screencast can also be played with right in your browser. Please note that both Moxie and Dojo Offline are still alpha; you are literally seeing Dojo Offline being developed in front of your eyes, and glitches remain in both of them. Please debug and provide test cases for errors you find to help development.



Info



Moxie Offline Demo




Sunday, February 25, 2007

"We make it easier to work with Yahoo’s services than Yahoo does." That is what Alex believes as he announces that Dojo supports Yahoo! Pipes, which adds to the forward-thinking JSON-P style endpoints.



It’s cool and interesting to be able to call out to Pipes from your server-side web-app, but what the mashup-mad word REALLY needs is to be able to do the same thing from a browser. Despite not really being in the docs anywhere, Yahoo’s Kent Brewster points out that Pipes supports a JSON-P callback argument. Awesome!


The structure of Pipes URLs are different than every other Yahoo service (much like flickr. ugg.), so there’s no Dojo RPC for it yet, but you can easily query a pipe using dojo.io.bind and the ScriptSrcIO transport:



JAVASCRIPT:





  1.  



  2. // get news results for Cometd



  3. dojo.require("dojo.io.ScriptSrcIO"); // the x-domain magic



  4. dojo.require("dojo.debug.console"); // firebug integration



  5. dojo.io.bind({



  6.   // grab this URL from the pipe you're interested in



  7.   url: "http://pipes.yahoo.com/pipes/fELaGmGz2xGtBTC3qe5lkA/run",



  8.   mimetype: "text/json",



  9.   transport: "ScriptSrcTransport",



  10.   jsonParamName: "callback”, // aha!



  11.   content: {



  12.     “render”: “json”,



  13.     “textinput1″: “cometd”



  14.   },



  15.   load: function(type, data, evt){



  16.      // log the response out to the Firebug console



  17.      dojo.require(”dojo.json”);



  18.      dojo.debug(dojo.json.serialize(arguments));



  19.   }



  20. });