如何在 YUI 中将事件挂钩到数据源?

发布于 2024-09-18 22:42:30 字数 272 浏览 3 评论 0原文

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

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

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

染墨丶若流云 2024-09-25 22:42:30

instance.subscribe(eventName,callback) 是 YUI 2 中跨组件的大多数事件的标准签名。YUI

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

3 遵循类似的约定,但使用 on() 和 after() 方法

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

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) { ... });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文