views:

25

answers:

1

http://developer.yahoo.com/yui/datasource/#events

I'm trying to use the responseParseEvent but I don't know how to hook into into my datasource object because YUI doesn't provide any examples.

Sidenote: Has anybody else noticed this with YUI? That their documentation doesn't contain nearly as many examples as jQuery?

+3  A: 

instance.subscribe(eventName, callback) is a standard signature for most events across components in YUI 2.

myDataSource.subscribe('responseParseEvent', function (e) {
    /*
     * available properties:
     *   e.request
     *   e.response
     *   e.callback
     *   e.caller
     */
});

YUI 3 follows a similar convention, but uses the methods on() and after()

myYUI3DataSource.on('data', function (e) { ... });
Luke