I learned how to develop in Javascript using the YUI 2 library, and wondered if there was a jQuery equivalent of custom events ( http://developer.yahoo.com/yui/event/#customevent )
In particular, I want to be able to define custom events without first connecting listeners.
In YUI, I will create a page class and declare different user events that you can subscribe to. Below is a sample code to demonstrate what I want to do, but using jQuery
function ListPage() {
var me = this;
this.initEvent = new YAHOO.util.CustomEvent("initEvent");
this.init = function() {
this.initEvent.fire(me);
}
}
In a Javascript application, I would like to subscribe to initEvent.
var page = new ListPage();
page.initEvent.subscribe(
function (type, args) {
}
);
page.init();
Are there any tutorials / examples of something similar in jQuery?
, - bind() trigger(), , , bind().
jQuery , ?
, . !