我们如何知道 YUI 中的回调函数传递了哪些参数?
来自 http://developer.yahoo.com/yui/docs /YAHOO.util.DataSourceBase.html#method_sendRequest,
您可以看到oCallback是一个具有以下属性的对象文字:
成功
数据准备好时调用的函数。
失败
在响应失败条件下调用的函数。
问题是它没有提到成功和失败回调函数可以使用哪些参数。尽管我们可以使用 firebug/其他工具来找出这一点,但如果文档中提供了此信息,那就更容易了。
在YUI中,有很多时候会用到回调函数。
我的问题是,yui网站上有这条信息吗?如果是的话,它在哪里?
From http://developer.yahoo.com/yui/docs/YAHOO.util.DataSourceBase.html#method_sendRequest,
you can see the oCallback is an object literal with the following properties:
success
The function to call when the data is ready.
failure
The function to call upon a response failure condition.
The problem is that it does not mention what parameters will be available to the success and failure callback functions. Although it's possible for us to use firebug/other tools to find that out, it would be easier if this info is available in the documentation.
In YUI, there are lots of times where callback functions will be used.
My question is that, is this piece of info available in yui website? If yes, where is it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它在页面上显示您链接到的内容将“传递给回调函数”:
然而他们没有说这是否会同时影响成功和失败。我想由于第二个参数 oParsedResponse 有一个 error 属性,它也适用于 failure 函数。
唯一可靠的方法是按照您提到的方式对其进行调试。
It says right on the page you linked to what will be "passed to the callback function":
However they don't say if this will be passed to both success and failure. I imagine since the second argument
oParsedResponse
has anerror
property that it is applicable tofailure
functions as well.The only sure fire way to know is to debug it as you mention.