JavaScript 处理程序调用 - 如何实现此结构?
不知道该怎么称呼这篇文章。我想模仿我在 Facebook 中看到的结构,但我实际上并没有使用 Facebook,这是一个很好的例子。我记得在使用 Facebook API 时,它有一个方法可以做到这一点:
FB_RequireFeatures(<key>, <handler>)
该方法本质上是说,如果该功能在函数调用时准备就绪,则立即调用处理程序。如果没有,则会排队并在可用时调用。
我想我明白如何自己实现这样的事情,但我想看看是否有其他人这样做过,如果你可以给我发送一个链接,那将会非常有帮助。
我想我也在实现类似于 JQuery 的就绪事件的东西;如果事件已经过去,则立即触发处理程序(我认为),但如果没有,则处理程序将排队。
谢谢。
Not sure what to call this post exactly. I want to mimic a structure I've seen in Facebook, but I'm not actually using Facebook, this was a good example. I remember from using the Facebook API that it had a method that did:
FB_RequireFeatures(<key>, <handler>)
This method essentially said if the feature was ready to go at the time of the function call, the handler was immediately invoked. If not, it was queued and called when it was available.
I think I understand how to implement something like this on my own, but I wanted to see if anyone else has done this, if you could send me a link, it would be very helpful to see.
I guess I am also implementing something similar to JQuery's ready event; if the event has already past, the handler is immediately fired (I think), but if not, the handler is queued.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论