Skip to content
Permalink
Browse files

Widget factory: Added trigger method for triggering callbacks and eve…

…nts.
  • Loading branch information
scottgonzalez committed Jul 10, 2008
1 parent 717630f commit d70f4f7620b97b119bba5a8cdf8f6fd1d7d5475c
Showing with 8 additions and 0 deletions.
  1. +8 −0 ui/ui.core.js
@@ -108,6 +108,7 @@ $.widget = function(name, prototype) {
var self = this;

this.widgetName = name;
this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
this.widgetBaseClass = namespace + '-' + name;

this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, options);
@@ -151,6 +152,13 @@ $.widget.prototype = {
},
disable: function() {
this.setData('disabled', true);
},

trigger: function(type, e, data) {
var eventName = (type == this.widgetEventPrefix
? type : this.widgetEventPrefix + type);
e = e || $.event.fix({ type: eventName, target: this.element[0] });
this.element.triggerHandler(eventName, [e, data], this.options[type]);
}
};

0 comments on commit d70f4f7

Please sign in to comment.
You can’t perform that action at this time.