2

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

我正在尝试使用 responseParseEvent 但我不知道如何连接到我的数据源对象,因为 YUI 没有提供任何示例。

旁注:有没有其他人注意到 YUI 的这一点?他们的文档包含的示例几乎没有 jQuery 那么多?

4

1 回答 1

5

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) { ... });
于 2010-09-15T15:14:23.103 回答