开发者

The purpose of YUI subscribe?

What is the purpose of subscribe? Here is my calendar control:

Code:

var myCal = new yuiCalendar('myCal');
var ripDate = function (type, args) {
   // My code
}

myCal.selectEvent.subscribe(ripDate);

Is this a custom event? Am I overriding the default event? Does this event get fired in the background irrespective if I subscribe to it? In .NET the control events are fired irrespective if you use them or not. How does this differ as to using .on(...)?

Can someone please give a decent description of using subscribe, if there is any documentation开发者_运维百科 (with possible sample code) then it would be appreciated.


YUI has a lot of documentation and examples.

You are not overriding the event by subscribing to it, you are listening for it, and acting upon any occurrences. You can subscribe as many times as you like, and they will be listened for in the order subscribed.

Subscribing to a CustomEvent docs

.on is an alias for AddListener, which is used to listen for DOM events.

Start with YUI 2's homepage and click around for docs and samples.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜