Fluid 0.8.5 with More JS API

Ok, lots of JavaScript goodies in this release.

First, this release should finally fix the Usercript persistence across launches bug! :0]

Now… on to the JavaScript API. First, the easy stuff:

  • window.fluid.log(obj). Logs to system log. Accepts any datatype, calls .toString() method.
  • window.fluid.beep(). Sounds system beep.
  • window.fluid.playSoundNamed(nameString). Plays system sound if name is valid.
  • window.fluid.setDockBadge(obj). Now accepts any datatype and calls .toString() on it.

Also, some improvements to window.fluid.showGrowlNotification(). There are two additional optional properties on the parameter argument object: indentifier and onclick. These are from the Growl API. identifier is a string and will cause multiple Growl notifications called quickly in succession with the same identifier to be coalesced. onclick is a JavaScript callback function that will be called if the user clicks on the Growl Notification. So:

window.fluid.showGrowlNotification({
    title: “title”,
    description: “description”,
    priority: 1,
    sticky: false,
    identifier: “foo”,
    onclick: callbackFunc
})

And last, but certainly not least, two major (but experimental) JavaScript API additions:

  • Experimental JavaScript libxml2 API. New in Fluid 0.8.5, an experimental native JavaScript implementation of libxml2’s XmlTextReader pull XML parser API. This is a first-of-its-kind, full-blown XML pull parser API for JavaScript. libxml2’s API itself was heavily inspired by Microsoft’s .NET XmlTextReader API.

    Under the hood, Fluid’s JavaScript XmlTextReader API is implemented using Apple’s new JavaScript Core framework in Leopard. JavaScript Core allows you to implement new native JavaScript types and expose them to a WebView’s JavaScript runtime. That’s what I’ve done here. See the JSDoc Class Documentation. This class has not been thoroughly tested.

    Example usage:

    var reader = new XmlTextReader("http://example.com/data.xml");
    while (reader.read()) {
        alert(reader.nodeType);
        alert(reader.name);
        alert(reader.localName);
        alert(reader.value);
        // etc...
    }
    							
  • Experimental implementation of Mozilla’s JavaScript SOAP API. New in Fluid 0.8.5, an experimental native JavaScript implementation of Mozilla’s JavaScript SOAP API.

Enjoy!


About this entry